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.

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(&FRMT) TYPE(*CHAR) LEN(8) VALUE('DEVD0600')
      DCL        VAR(&DEVD) 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 &FRMT &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)
 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