If you use these programs you increase your "freedom". You do not have to check the active jobs every minute. Just...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
submit the first CL program and it will send you a message when any job is in the specified status (MSGW, HLD etc.) The idea is not to only watch the job status. I think it is more. If you modify the program it can alert you, when a specified user signed on or a specified subsystem started etc.
- You do not have to use the WRKACTJOB in this program. If you use WRKCFGSTS you can monitor a LINE,CTL,DEV etc. when became active.
- The type of alert can be modified too. I use SNDDST to send an e-mail to my address at my mobile phone provider. I use a mail notification service and they send me an SMS when I get an e-mail. The SMS contains the subject of e-mail sent by the AS/400. It works fine. It is good thing, when I started a lot of jobs to run for the weekend and those have to finish by Monday morning. I can be sure there is no MSGW or HLD status! I use SNDBRKMSG when I'm in a computer room or in my workshop. Easy to hear a big beep if an MSGW occur while you use another application!
It is a simple solution for daily problems, made in CL without API-s and easy to understand. We have used this for about 3 years. It became a standard and helpful tool for us! If you have any questions about this tip, you can e-mail Jozsef Petrovszki. Additional tip: If you use serial jobq to run your jobs, submit an SNDDST or SNDBRKMSG command after the jobs and you will be notified when all your jobs finished!
1st. Caller program: Compile to name ALERT the code: PGM PARM(&STS) DCL VAR(&ERROR) TYPE(*CHAR) LEN(1) DCL VAR(&STS) TYPE(*CHAR) LEN(4) DCL VAR(&TXT) TYPE(*CHAR) LEN(60) START: OVRPRTF FILE(QPDSPAJB) HOLD(*YES) WRKACTJOB OUTPUT(*PRINT) DLTOVR FILE(QPDSPAJB) CHKOBJ OBJ(QTEMP/ALERTJOB) OBJTYPE(*FILE) MONMSG MSGID(CPF9801) EXEC(DO) CRTPF FILE(QTEMP/ALERTJOB) RCDLEN(132) ENDDO CPYSPLF FILE(QPDSPAJB) TOFILE(QTEMP/ALERTJOB) + SPLNBR(*LAST) DLTSPLF FILE(QPDSPAJB) SPLNBR(*LAST) CALL PGM(yourlib/ALERTW) PARM(&STS &ERROR &TXT) IF COND(&ERROR *EQ '1') THEN(DO) SNDDST TYPE(*LMSG) TOINTNET((firstname.lastname@example.org)) + DSTD('alert') LONGMSG(B) SUBJECT(&TXT) SNDBRKMSG MSG(&TXT) TOMSGQ(DSP01 DSP02 DSP06 DSP07) GOTO CMDLBL(END) ENDDO DLYJOB DLY(180) GOTO CMDLBL(START) END: ENDPGM
2nd: Finder program: Compile to name ALERTW This program called by the first CL program (ALERT) Before you compile it you have to create a workfile in qtemp with CRTPF FILE(QTEMP/ALERTJOB) RCDLEN(132) command!
PGM PARM(&STS &ERROR &TXT) DCL VAR(&STS) TYPE(*CHAR) LEN(4) DCL VAR(&ERROR) TYPE(*CHAR) LEN(1) DCL VAR(&TXT) TYPE(*CHAR) LEN(60) DCLF FILE(QTEMP/ALERTJOB) CHGVAR VAR(&ERROR) VALUE('0') READ: RCVF RCDFMT(ALERTJOB) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) IF COND(%SST(&ALERTJOB 111 4) *EQ &STS) + THEN(DO) CHGVAR VAR(&ERROR) VALUE('1') CHGVAR VAR(&TXT) VALUE(&STS *CAT ' status : ' *CAT + %SST(&ALERTJOB 29 6) *CAT '/' *CAT + %SST(&ALERTJOB 17 10) *TCAT '/' *CAT + %SST(&ALERTJOB 4 10) *CAT '!!!') ENDDO GOTO READ END: ENDPGM