iseriesuniversity

Sunday, October 29, 2006

Retreive IP address of your interactive job

The below program uses API QDCRDEVD to retrieve the ip address of the current interactive job.

More information on the API QDCRDEVD can be sought from the site.

http://as400bks.rochester.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/QDCRDEVD.htm


PGM
/***********************************************************************************/
Declaration Section
/***********************************************************************************/
DCL VAR(&RECEIVER) TYPE(*CHAR) LEN(1000)
DCL VAR(&RCVLEN) TYPE(*CHAR) LEN(4)
DCL VAR(&DEVICE) TYPE(*CHAR) LEN(10)
DCL VAR(&IP_ADR) TYPE(*CHAR) LEN(15)
/***********************************************************************************/
Processing Section
/***********************************************************************************/ CHGVAR VAR(%BIN(&RCVLEN)) VALUE(1000)
RTVJOBA JOB(&DEVICE)
CALL PGM(QDCRDEVD) PARM(&RECEIVER &RCVLEN +
'DEVD0600' &DEVICE X'00000000')
CHGVAR VAR(&IP_ADR) VALUE(%SST(&RECEIVER 878 15))
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
device name is' |> &DEVICE)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('The +
ip address of the system is' |> &ip_adr)
/***********************************************************************************/
We are done with it
/***********************************************************************************/
ENDPGM

Mail me at dean@iseriesuniversity.com for further doubts and clarifications.

C U
Subbu

0 Comments:

Post a Comment

<< Home