IBM Support

Sample of a CL Program That Uses the QDCRDEVD API

Troubleshooting


Problem

This document provides a sample of using the QDCRDEVD API in a CL program.

Resolving The Problem

The following CL program shows how to code the QDCRDEVD API in a CLP. The QDCRDEVD API is used to retrieve the TCP/IP address of a user device that is connected to the IBM i products.
Call format 100 first, and then if it is a display device, use format 600 to retrieve the information.

Example Code named DCRDEVD1:

             PGM        PARM(&DEVD)

             DCL        VAR(&DEVINFO) TYPE(*CHAR) LEN(999)
             DCL        VAR(&LENVAR) TYPE(*DEC) LEN(3 0) VALUE(999)
             DCL        VAR(&LENVARBIN) TYPE(*CHAR) LEN(4) VALUE(X'00000000')
             DCL        VAR(&FRMT1) TYPE(*CHAR) LEN(8) VALUE('DEVD0100')
             DCL        VAR(&FRMT6) TYPE(*CHAR) LEN(8) VALUE('DEVD0600')
             DCL        VAR(&DEVD) TYPE(*CHAR) LEN(10)
             DCL        VAR(&DCAT) TYPE(*CHAR) LEN(10)
             DCL        VAR(&MSG) TYPE(*CHAR) LEN(50)
             DCL        VAR(&ERRCDE) TYPE(*CHAR) LEN(32)
             DCL        VAR(&IPADDR) TYPE(*CHAR) LEN(15)

             CHGVAR     %BIN(&LENVARBIN) &LENVAR

             CALL       QDCRDEVD (&DEVINFO &LENVARBIN &FRMT1 &DEVD &ERRCDE)
             MONMSG     MSGID(CPF2702) EXEC(GOTO CMDLBL(NODEV))
             CHGVAR     VAR(&DCAT) VALUE(%SST(&DEVINFO 32 10))
             IF         COND(&DCAT = '*DSP') THEN(DO)
                CALL       QDCRDEVD (&DEVINFO &LENVARBIN &FRMT6 &DEVD &ERRCDE)
                MONMSG     MSGID(CPF2702) EXEC(GOTO CMDLBL(NODEV))
                CHGVAR     VAR(&IPADDR) VALUE(%SST(&DEVINFO 877 15))
                CHGVAR     VAR(&MSG) VALUE(&DEVD *BCAT 'IS BEING USED BY' *BCAT &IPADDR)
                SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&MSG) TOPGMQ(*PRV) MSGTYPE(*ESCAPE)
                GOTO       CMDLBL(END)
             ENDDO
 NODEV:
             SNDMSG     MSG(&DEVD *BCAT 'IS NOT A KNOWN DEVICE') TOUSR(*SYSOPR)
 END:
             ENDPGM
 

To call the program, type the following command:
 
 > call dcrdevd1 'QPADEV0004'                 
   QPADEV0004 IS BEING USED BY  10.15.0.101.  

 

[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m3p000000hB4rAAE","label":"API"},{"code":"a8m3p0000006x8GAAQ","label":"CL"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Historical Number

440228328

Document Information

More support for:
IBM i

Component:
API, CL

Software version:
All Versions

Operating system(s):
IBM i

Document number:
636937

Modified date:
15 November 2024

UID

nas8N1014558

Manage My Notification Subscriptions