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 System i products.
Call format 100 first, and then if it is a display device, use format 600 to retrieve the information.

Example Code:

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 PGM(PGMNAME) PARM(DEVNME)

Press the Enter key.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

440228328

Document Information

Modified date:
18 December 2019

UID

nas8N1014558