如何動態使用 Library list ? (Command: USEJOBDILL API QWDRJOBD)
File : QCLSRC
Member: USEJOBDILL
Type : CLP
Usage : CRTCLPGM USEJOBDILL
/* =============================================================== */
/* = Command USEJOBDILL CPP = */
/* = USEJOBDILL = */
/* = Paramater notes: = */
/* = JOBDQUAL: JobD name = */
/* =============================================================== */
/* = Date : 2006/05/30 = */
/* = Author: Vengoal Chang = */
/* =============================================================== */
CHKJOBDINL: PGM PARM(&JOBDQUAL)
DCL VAR(&JOBDQUAL) TYPE(*CHAR) LEN(20) /* +
Qualified job description name */
DCL VAR(&LIB) TYPE(*CHAR) LEN(10)
DCL VAR(&JOBD) TYPE(*CHAR) LEN(10)
DCL VAR(&CMD) TYPE(*CHAR) LEN(3000)
DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) VALUE(3000)
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 &MsgId *CHAR 7
dcl &MsgDta *CHAR 256
dcl &MSGF *CHAR 10
dcl &MSGFLIB *CHAR 10
dcl &MSGTXT *CHAR 256
MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO error)
CHGVAR VAR(&JOBD) VALUE(%SST(&JOBDQUAL 1 10))
CHGVAR VAR(&LIB) VALUE(%SST(&JOBDQUAL 11 10))
CHKOBJ OBJ(&LIB/&JOBD) OBJTYPE(*JOBD)
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))
/* Check library exist or not */
CHGVAR VAR(&I) VALUE(0)
NEXT: CHGVAR VAR(&J) VALUE((&I * 11) + 1)
CHGVAR &LIB %SST(&INLLIBL &J 10)
IF (&LIB *NE ' ') DO
CHKOBJ OBJ(&LIB) OBJTYPE(*LIB)
ENDDO
CHGVAR VAR(&I) VALUE(&I + 1)
IF COND(&I *LT %BIN(&ENTNBR)) THEN(GOTO +
CMDLBL(NEXT))
CHGVAR VAR(&CMD) VALUE('CHGLIBL (' *BCAT &INLLIBL +
*TCAT ')')
CALL PGM(QCMDEXC) PARM(&CMD &CMDLEN)
Return
/* =============================================================== */
/* = Error routine = */
/* =============================================================== */
Error:
RcvMsg MsgType( *Excp ) +
MsgDta( &MsgDta ) +
MsgID( &MsgID ) +
MsgF( &MsgF ) +
MsgFLib( &MsgFLib )
MonMsg ( CPF0000 MCH0000 )
SndMsg:
SndPgmMsg MsgID( &MsgID ) +
MsgF( &MsgFLib/&MsgF ) +
MsgDta( &MsgDta ) +
MsgType( *Escape )
MonMsg ( CPF0000 MCH0000 )
/* =============================================================== */
/* = End of program = */
/* =============================================================== */
endpgm
File : QCMDSRC
Member: USEJOBDILL
Type : CMD
Usage : CRTCMD CMD(USEJOBDILL) PGM(USEJOBDILL)
Usage : Create two jobd with your own library list, one is for testing environment,
the other is for production environment.
USEJOBDILL JOBD(yourlib/testing_jobd)
or
USEJOBDILL JOBD(yourlib/production_jobd)
所以你不用總是使用 addlible 或 chglibl 修改或增加 library list, 也不用將
Library list 至於程式中. 將省去不少測試時間, 若要更改 library list, 只要更改
Jobd 的 INLLIBL 參數即可.
/* =============================================================== */
/* = Command....... USEJOBDILL = */
/* = CPP........... USEJOBDILL = */
/* = Description... Use Jobd initial library list as runtime = */
/* = library list = */
/* = = */
/* = CrtCmd Cmd( USEJOBDILL) = */
/* = Pgm( USEJOBDILL ) = */
/* = SrcFile( YourSourceFile ) = */
/* =============================================================== */
/* = Date : 2006/05/30 = */
/* = Author: Vengoal Chang = */
/* =============================================================== */
CMD PROMPT('Use JOBD Initial Library List')
Parm Kwd( JobD ) +
Type( QObj ) +
Min( 1 ) +
Prompt( 'Job Descriptoion' )
QObj: Qual Type( *Name ) +
Len( 10 ) +
Min( 1 ) +
Expr( *Yes )
Qual Type( *Name ) +
Len( 10 ) +
Min( 1 ) +
Expr( *Yes ) +
Prompt( 'Library' )
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期二, 11月 07, 2023
2007-04-17 如何動態使用 Library list ? (Command: USEJOBDILL API QWDRJOBD)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言