Skip to main content

Sample of a CL Program That Uses the QDCRDEVD API


 Technote

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.






System i Support


    IBM disclaims all warranties, whether express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. By furnishing this document, IBM grants no licenses to any related patents or copyrights. Copyright © 1996,1997,1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 IBM Corporation. Any trademarks and product or brand names referenced in this document are the property of their respective owners. Consult the Terms of use link for trademark information.

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

i family


Software version:
V5R1M0, V5R2M0, V5R3M0, V5R3M5, V5R4M0, V5R4M5, V6R1M0


Operating system(s):
OS/400


Reference #:
440228328


Modified date:
2012-04-23

Translate my page

Content navigation