Q: Is there a way that I can automatically scan the error log for disk errors and notify the operators when one is found?
A: In Figures 1 and 2 you can see the source for the Check Disk Error (CHKDSKERR) command that I use to do what you described. The program prints the error log, then copies it to a physical file. It then uses QCLSCAN to check for certain error codes. In the sample program, it is looking for error code 6109. You may need to modify the program to look for error codes that pertain to your site. If it finds the specified code in the listing, the program sends a message to the system operator message queue. Then the operator can review the error log using the Print Error Log (PRTERRLOG) command.
Checking For Disk Errors
Figure 1 PRL001CL CL Source
/*==================================================================*/ /* To compile: */ /* */ /* CRTCLPGM PGM(XXX/PRL001CL) SRCFILE(XXX/QCLSRC) */ /* */ /*==================================================================*/ PRL001CL: PGM PARM(&BEGDATE) DCLF FILE(LISTFILE) DCL VAR(&BEGDATE) TYPE(*CHAR) LEN(6) DCL VAR(&LEN) TYPE(*DEC) LEN(3 0) VALUE(132) DCL VAR(&FROM) TYPE(*DEC) LEN(3 0) VALUE(1) DCL VAR(&RESULT) TYPE(*DEC) LEN(3 0) DCL VAR(&SCLEN) TYPE(*DEC) LEN(3 0) VALUE(4) MONMSG MSGID(CPF0000) CRTPF FILE(QTEMP/LISTFILE) RCDLEN(132) SIZE(*NOMAX) OVRPRTF FILE(QPCSMPRT) HOLD(*YES) PRTERRLOG PERIOD((000001 &BEGDATE) (*AVAIL)) CPYSPLF FILE(QPCSMPRT) TOFILE(QTEMP/LISTFILE) + SPLNBR(*LAST) MBROPT(*REPLACE) DLTOVR FILE(QPCSMPRT) DLTSPLF FILE(QPCSMPRT) SPLNBR(*LAST) READ: RCVF MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM)) CALL PGM(QCLSCAN) PARM(&LISTFILE &LEN &FROM + '6109' &SCLEN '' '' '' &RESULT) IF COND(&RESULT *GT 0) THEN(DO) SNDMSG MSG('DISK ERROR ---> REVIEW PRTERRLOG + LISTING') TOUSR(*SYSOPR) GOTO CMDLBL(ENDPGM) ENDDO GOTO CMDLBL(READ) ENDPGM: DLTF FILE(QTEMP/LISTFILE) ENDPGM
Checking For Disk Errors
Figure 2 CHKDSKERR Command Source
/*==================================================================*/ /* To compile: */ /* */ /* CRTCMD CMD(XXX/CHKDSKERR) PGM(XXX/PRL001CL) + */ /* SRCFILE(XXX/QCMDSRC) */ /* */ /*==================================================================*/ CHKDSKERR: CMD PROMPT('Check For Disk Errors') PARM KWD(DATE) TYPE(*CHAR) LEN(6) RANGE('000000' + '999999') MIN(1) PROMPT('Date To Look For + Disk Error')
LATEST COMMENTS
MC Press Online