iseriesuniversity

Tuesday, October 31, 2006

Retreive the current OS Version!

The following program illustrates the way to find the corrent OS level using the API QSZRTVPR, in a CL program.

PGM
DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(256)
DCL VAR(&RELEASE) TYPE(*CHAR) LEN(6)
DCL VAR(&PRODID) TYPE(*CHAR) LEN(27)
DCL VAR(&RCVLEN) TYPE(*CHAR) LEN(4)
CHGVAR VAR(%BIN(&RCVLEN 1 4)) VALUE(32)
CHGVAR VAR(%SST(&PRODID 1 7)) VALUE(*OPSYS)
CHGVAR VAR(%SST(&PRODID 8 6)) VALUE(*CUR)
CHGVAR VAR(%SST(&PRODID 14 4)) VALUE('0000')
CHGVAR VAR(%SST(&PRODID 18 10)) VALUE(*CODE)
CALL PGM(QSZRTVPR) PARM(&RCVVAR &RCVLEN +
'PRDR0100' &PRODID X'00000000')
CHGVAR VAR(&RELEASE) VALUE(%SST(&RCVVAR 20 6))
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('THE +
RELEASE OF THIS OPERATING SYSTEM IS ' |> &RELEASE)
ENDPGM

For more information on the API QSZRTVPR, refer to IBM site.

http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?info/apis/qszrtvpr.htm

Any queries or clarifications mail dean@iseriesuniversity.com

Thanks

Subbu

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

CL program to Varyon/off devices!

The program varies on all the varied off devices.

PGM
DCL VAR(&STSCDE) TYPE(*DEC) LEN(5 0)
DCLF FILE(SUBBU/DSPDEVSTS)
DSPOBJD OBJ(QPADEV*) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DSPDEVSTS)
OVRDBF FILE(DSPDEVSTS) TOFILE(QTEMP/DSPDEVSTS) +
MBR(*FIRST) SECURE(*YES)
NEXT: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
RTVCFGSTS CFGD(&ODOBNM) CFGTYPE(*DEV) STSCDE(&STSCDE)
IF COND(&STSCDE = 0) THEN(VRYCFG +
CFGOBJ(&ODOBNM) CFGTYPE(*DEV) +
STATUS(*ON) RANGE(*OBJ))
GOTO CMDLBL(NEXT)
ENDPGM: ENDPGM

ALternatively the program can be modified for varying on the Varied off devices.

PGM
DCL VAR(&STSCDE) TYPE(*DEC) LEN(5 0)
DCLF FILE(SUBBU/DSPDEVSTS)
DSPOBJD OBJ(QPADEV*) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) +
OUTFILE(QTEMP/DSPDEVSTS)
OVRDBF FILE(DSPDEVSTS) TOFILE(QTEMP/DSPDEVSTS) +
MBR(*FIRST) SECURE(*YES)
NEXT: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
RTVCFGSTS CFGD(&ODOBNM) CFGTYPE(*DEV) STSCDE(&STSCDE)
IF COND(&STSCDE = 20) THEN(VRYCFG +
CFGOBJ(&ODOBNM) CFGTYPE(*DEV) +
STATUS(*OFF) RANGE(*OBJ))
GOTO CMDLBL(NEXT)
ENDPGM: ENDPGM

For any further clarification or doubts, I request the students to mail me on dean@iseriesuniversity.com

Thank you!

Subbu

Introduction!

Hi,

I am Subramaniam.S, iSeries Consultant from India. I have started this blog to share the excercises on iSeries System Administration with my Students and other Admins.

Mail me on dean@iseriesuniversity.com.

Thank you!