Sample of a CL Program That Uses the QDCRDEVD API

Technote (troubleshooting)


Problem(Abstract)

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.

Historical Number

440228328

Rate this page:

(0 users)Average rating

Document information


More support for:

IBM i
Programming (Languages- compilers- tools)

Software version:

5.1.0, 5.2.0, 5.3.0, 5.3.5, 5.4.0, 5.4.5, 6.1.0, 7.1.0

Operating system(s):

IBM i

Reference #:

N1014558

Modified date:

2012-04-23

Translate my page

Machine Translation

Content navigation