This utility displays the IP address associated with a display device used for a Telnet session. This can be useful when the device name, such as QPADEV0001, gives no clue as to the location of the connection.
DSPDEVIPAD Command:
CMD PROMPT('Display Device IP Address')
PARM KWD(DEVICE) TYPE(*CHAR) LEN(10) DFT(*ALL) +
MIN(0) CHOICE('Name, generic*, *ALL') +
PROMPT('Device Name')
=====================================
DSPDEVIPAD CLP:
/***************************************************************/
/*Description: Display Ip Address of requested Device. */
/*Author: Chris Schletty */
/*Date: 02Jul99 */
/* */
/* Using the QDCRDEVD API, this program displays */
/* the IP address of the device specified in */
/* the input parameter. */
/* */
/***************************************************************/
/*Mods: */
/* */
/*15Sep00 C.Schletty Display Job Information. */
/*22Dec99 C.Schletty Allow *ALL/Generic*. */
/* Place results in message file. */
/* */
/***************************************************************/
PGM PARM(&DEV)
DCL VAR(&APIOUT) TYPE(*CHAR) LEN(1000)
DCL VAR(&DEV) TYPE(*CHAR) LEN(10)
DCL VAR(&IPADR) TYPE(*CHAR) LEN(15)
DCL VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) /* Job +
Type: 0=Batch 1=Interactive */
DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBUSER) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBNBR) TYPE(*CHAR) LEN(6)
DCLF FILE(QADSPOBJ)
/* Default error handling. */
MONMSG MSGID(CPF0000)
/* Create message file in QTEMP for report. */
CRTMSGQ MSGQ(QTEMP/DEVD)
MONMSG MSGID(CPF0000) EXEC(RMVMSG MSGQ(QTEMP/DEVD) +
CLEAR(*ALL))
/* Build QTEMP file with device information. */
DSPOBJD OBJ(QSYS/&DEV) OBJTYPE(*DEVD) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/DEVD)
MONMSG MSGID(CPF0000) EXEC(DO) /* No luck. Send +
error message. */
SNDPGMMSG MSG('Unable to obtain information for +
device' *BCAT &DEV)
RETURN
ENDDO
OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/DEVD)
READNEXT: RCVF /* Get next record. */
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(END)) /* +
Exit at end of file. */
IF COND(&ODOBAT *NE 'DSPVRT') THEN(GOTO +
CMDLBL(READNEXT)) /* Ignore all but +
virtual display devices. */
CALL PGM(QDCRDEVD) PARM(&APIOUT X'0000039A' +
'DEVD0600' &ODOBNM X'0000') /* Call API +
requesting DEVD0600 format which is used +
to describe *DSP devices. */
CHGVAR &IPADR %SST(&APIOUT 878 15)
IF COND(&IPADR < ' ') THEN(GOTO +
CMDLBL(READNEXT)) /* Bypass message if no +
IP Address found. */
CHGVAR VAR(&JOBNAME) VALUE(%SST(&APIOUT 893 10))
CHGVAR VAR(&JOBUSER) VALUE(%SST(&APIOUT 903 10))
CHGVAR VAR(&JOBNBR ) VALUE(%SST(&APIOUT 913 6))
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&ODOBNM +
*TCAT ':' *BCAT &IPADR *CAT ' Job:' *BCAT +
&JOBNBR *TCAT '/' *TCAT &JOBUSER *TCAT +
'/' *TCAT &JOBNAME) TOMSGQ(QTEMP/DEVD)
GOTO CMDLBL(READNEXT) /* Next record. */
END: DSPMSG MSGQ(QTEMP/DEVD) START(*FIRST)
ENDPGM
================================== MORE INFORMATION ON THIS TOPIC ==================================
The Best Web Links: tips, tutorials and more.
Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.
This was first published in September 2001