如何檢查 JobD 中的 Initial library list 是否含有某個 Library ?(使用 API QWDRJOBD)
JobD 包含使用者的工作環境設定, 可以使用 API QWDRJOBD 取得相關 JobD 的資訊.
File : QCLSRC
Member: CHKJOBDINL
Type : CLP
OS Version: no limit
Usage : CRTCLPGM CHKJOBDINL
CALL CHKJOBDINL 'library'
CALL CHKJOBDINL 'QGPL'
/* Program : CHKJOBDINL */
/* */
/* Description : Check all job descriptions if a certain library */
/* exists in the initial library list. */
/* */
/* Input Parameters : */
/* ---------------- */
/* &LIB Library to check for in all jobd */
/* */
CHKJOBDINL: PGM PARM(&LIB)
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBDQUAL) TYPE(*CHAR) LEN(20) /* +
Qualified job description name */
DCL VAR(&INLLIBL) TYPE(*CHAR) LEN(2750)
DCL VAR(&STARTPOS) TYPE(*DEC) LEN(5 0) /* +
Substring start position */
DCL VAR(&LEN) TYPE(*DEC) LEN(5 0) /* Length of +
array with libraries */
DCL VAR(&RECEIVER) TYPE(*CHAR) LEN(7000)
DCL VAR(&RECLEN) TYPE(*CHAR) LEN(4) /* receiver +
length */
DCL VAR(&OFFSET) TYPE(*CHAR) LEN(4) /* Offset to +
initial library list in Binary */
DCL VAR(&ENTNBR) TYPE(*CHAR) LEN(4) /* Number of +
libraries in Binary */
DCL VAR(&I) TYPE(*DEC) LEN(5 0) VALUE(0)
DCL VAR(&J) TYPE(*DEC) LEN(5 0)
DCL VAR(&NBR) TYPE(*DEC) LEN(7 0)
DCL VAR(&NBR_CHR) TYPE(*CHAR) LEN(7)
DCLF FILE(QSYS/QADSPOBJ)
CHGVAR VAR(%BIN(&RECLEN)) VALUE(7000)
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*JOBD) +
OUTPUT(*OUTFILE) OUTFILE(QTEMP/ALLJOBD)
OVRDBF FILE(QADSPOBJ) TOFILE(QTEMP/ALLJOBD)
READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF))
CHGVAR VAR(&JOBDQUAL) VALUE(&ODOBNM *CAT &ODLBNM)
CALL PGM(QWDRJOBD) PARM(&RECEIVER &RECLEN +
'JOBD0100' &JOBDQUAL X'00000000')
CHGVAR VAR(&OFFSET) VALUE(%SST(&RECEIVER 361 4))
CHGVAR VAR(&STARTPOS) VALUE(%BIN(&OFFSET) + 1)
CHGVAR VAR(&ENTNBR) VALUE(%SST(&RECEIVER 365 4))
CHGVAR VAR(&LEN) VALUE(%BIN(&ENTNBR) * 11)
CHGVAR VAR(&INLLIBL) VALUE(%SST(&RECEIVER &STARTPOS +
&LEN))
CHGVAR VAR(&I) VALUE(0)
NEXT: CHGVAR VAR(&J) VALUE((&I * 11) + 1)
IF COND(%SST(&INLLIBL &J 10) *EQ &LIB) +
THEN(GOTO CMDLBL(FOUND))
CHGVAR VAR(&I) VALUE(&I + 1)
IF COND(&I *LT 250) THEN(GOTO CMDLBL(NEXT))
GOTO CMDLBL(READ)
FOUND: SNDPGMMSG MSG('Library ' *CAT &LIB *BCAT 'found in +
jobd' *BCAT &ODLBNM *TCAT '/' *CAT &ODOBNM)
CHGVAR VAR(&NBR) VALUE(&NBR + 1)
GOTO CMDLBL(READ)
EOF: DLTF FILE(QTEMP/ALLJOBD)
CHGVAR VAR(&NBR_CHR) VALUE(&NBR)
SNDPGMMSG MSG('Library ' *CAT &LIB *BCAT 'found' *BCAT +
&NBR_CHR *BCAT 'times in job descriptions.')
END: ENDPGM
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期四, 11月 02, 2023
2002-11-06 如何檢查 JobD 中的 Initial library list 是否含有某個 Library ?(使用 API QWDRJOBD)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言