/*===================================================================*/ /* PROGRAM NAME : AUTOUPDLIB */ /* CREATED BY : BOT LIU YUAN YAO */ /* CREATED DATE : 2008/02/21 */ /* DESCRIPTION : AUTO-UPDATE OVER SELECTED LIBRARIES */ /* USAGE : BEFORE COMPILE [2008/03/06 DSPOBJD->DSPFD] */ /* DSPFD FILE(&TRGLIB/*ALL) TYPE(*MBR) + */ /* OUTPUT(*OUTFILE) OUTFILE(QTEMP/WORKFILE) */ /*===================================================================*/ PGM PARM(&SRCLIB &TRGLIB)
DCL VAR(&SRCLIB) TYPE(*CHAR) LEN(10) DCL VAR(&TRGLIB) TYPE(*CHAR) LEN(10) DCLF FILE(QTEMP/WORKFILE) RCDFMT(QWHFDMBR)
DCL VAR(&SRCAUTL) TYPE(*CHAR) LEN(10) DCL VAR(&TRGAUTL) TYPE(*CHAR) LEN(10) /** AUTO-DELETE ALL LF OF TARGET LIBRARY [2008/03/06] **/ DSPFD FILE(&TRGLIB/*ALL) TYPE(*MBR) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/WORKFILE) MONMSG MSGID(CPF2123) EXEC(GOTO CMDLBL(NEXT)) LOOP: RCVF RCDFMT(QWHFDMBR) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(NEXT)) IF COND(&MBFATR *EQ 'LF') THEN(DO) DLTF FILE(&TRGLIB/&MBFILE) ENDDO GOTO CMDLBL(LOOP) NEXT: CLRLIB LIB(&TRGLIB) MONMSG MSGID(CPF0000) /** USE TEMPORARY SAVF TO SAVE AND RESTORE LIBRARY **/ CRTSAVF FILE(QTEMP/TMPSAVF) TEXT('Temporary savf') SAVLIB LIB(&SRCLIB) DEV(*SAVF) SAVF(QTEMP/TMPSAVF) + SAVACT(*LIB) MONMSG MSGID(CPF0000) RSTLIB SAVLIB(&SRCLIB) DEV(*SAVF) + SAVF(QTEMP/TMPSAVF) RSTLIB(&TRGLIB) MONMSG MSGID(CPF0000) /** AUTO-MAINTAIN AUTHORIZATION LIST [2008/03/05] **/ CHGVAR VAR(&SRCAUTL) VALUE('A' *CAT %SST(&SRCLIB 1 + 7)) CHGVAR VAR(&TRGAUTL) VALUE('A' *CAT %SST(&TRGLIB 1 3)) CHKOBJ OBJ(&SRCAUTL) OBJTYPE(*AUTL) MONMSG MSGID(CPF9801) EXEC(GOTO CMDLBL(GRTAUTL)) RVKOBJAUT OBJ(&TRGLIB/*ALL) OBJTYPE(*ALL) AUTL(&SRCAUTL) MONMSG MSGID(CPF0000) GRTAUTL: CHKOBJ OBJ(&TRGAUTL) OBJTYPE(*AUTL) MONMSG MSGID(CPF9801) EXEC(DO) CRTAUTL AUTL(&TRGAUTL) ENDDO GRTOBJAUT OBJ(&TRGLIB/*ALL) OBJTYPE(*ALL) AUTL(&TRGAUTL) MONMSG MSGID(CPF0000) GRTOBJAUT OBJ(&TRGLIB/*ALL) OBJTYPE(*ALL) + USER(*PUBLIC) AUT(*EXCLUDE) MONMSG MSGID(CPF0000) /** AUTO-SEND EMAIL TO OPERATOR AFTER FINISHED ALL STEPS **/ SNDDST TYPE(*LMSG) + TOINTNET((liuyuanyao@swirebev.com)) + DSTD('Update Data Successfully!') + LONGMSG('Update data from source to + target library successfully,thanks!') ENDPGM: DLTF FILE(QTEMP/WORKFILE) MONMSG MSGID(CPF2105) DLTF FILE(QTEMP/TMPSAVF) MONMSG MSGID(CPF2105) ENDPGM |
/*===================================================================*/ /* PROGRAM NAME : AUTOUPDLIB */ /* DESCRIPTION : AUTO-UPDATE OVER SELECTED LIBRARIES */ /* PROGRAMMER : BOT LIU YUAN YAO */ /* DATE : 2008/02/27 */ /*===================================================================*/ CMD PROMPT('Auto-Update Selected Libraries') PARM KWD(SRCLIB) TYPE(*CHAR) LEN(10) + DFT('SRCLIB') REL(*NE ' ') + SPCVAL(('HZTDB01') ('XMTDB01') + ('GDTDB01') ('NJTDB01') ('XATDB01') + ('ZZTDB01') ('HFTDB01') ('LQTDB01')) + MIN(0) MAX(1) PROMPT('Source Library') PARM KWD(TRGLIB) TYPE(*CHAR) LEN(10) + DFT('TRGLIB') REL(*NE ' ') + SPCVAL((HHDXA01) (HHDXA02) (HHDXA03) + (HHDXA05) (HHDXA06) (HHDHF01) (HZUDB01) + (XMPDB01)) MIN(0) MAX(1) PROMPT('Traget + Library') |
Type choices, press Enter.
Source Library . . . . . . . . . > 'srclib' Character value, HZTDB01...
Traget Library . . . . . . . . . > 'trglib' Character value, HHDXA01...