Return to the CL Tips
A simple batch debugging tool. It is easy to set it up.
Program: BTCHDBG (CLP)
PGM PARM(&PARM1 &PARM2 &PARM3 &PARM4) DCL VAR(&PARM1) TYPE(*CHAR) LEN(512) DCL VAR(&PARM2) TYPE(*CHAR) LEN(3) DCL VAR(&PARM3) TYPE(*CHAR) LEN(512) DCL VAR(&PARM4) TYPE(*CHAR) LEN(10) DCL VAR(&JOBATR) TYPE(*CHAR) LEN(1) DCL VAR(&RQSTDTA) TYPE(*CHAR) LEN(3000) DCL VAR(&CALL) TYPE(*CHAR) LEN(25) VALUE('CALL + ITAPVS/BTCHDBG PARM(') DCL VAR(&CALL1) TYPE(*CHAR) LEN(1) VALUE(')') DCL VAR("E) TYPE(*CHAR) LEN(1) VALUE(X'7D') DCL VAR(&USERID) TYPE(*CHAR) LEN(10) DCL VAR(&RETRY) TYPE(*DEC) LEN(3 0) VALUE(0) DCL VAR(&TIME) TYPE(*CHAR) LEN(6) DCL VAR(&JOBNAME) TYPE(*CHAR) LEN(10) RTVSYSVAL SYSVAL(QTIME) RTNVAR(&TIME) CHGVAR VAR(&JOBNAME) VALUE('DBG' || &TIME) RTVJOBA USER(&USERID) TYPE(&JOBATR) IF COND(&JOBATR *EQ '1') THEN(DO) STRSRVJOB JOB(&JOBNAME) DUPJOBOPT(*MSG) MONMSG MSGID(CPF3536 CPF3520) EXEC(DO) CHGVAR VAR(&RQSTDTA) VALUE(&CALL || "E || + &PARM1 || "E || ' ' || "E || + &PARM2 || "E || ' ' || "E || + &PARM3 || "E || ' ' || "E || + &PARM4 || "E || &CALL1) SBMJOB JOB(&JOBNAME) JOBQ(&PARM4) RQSDTA(&RQSTDTA) + LOG(*JOBD *JOBD *MSG) LOGCLPGM(*YES) IF COND(&PARM3 *NE ' ') THEN(DO) RETRY: CHGVAR VAR(&RETRY) VALUE(&RETRY + 1) STRSRVJOB JOB(&JOBNAME) DUPJOBOPT(*MSG) MONMSG MSGID(CPF3536) EXEC(DO) IF COND(&RETRY *EQ 10) THEN(DO) SNDMSG MSG('The job ' || &JOBNAME *TCAT ' is + not active to perform the STRSRVJOB and + the debug command. Perform the required + command manually.') TOUSR(&USERID) GOTO CMDLBL(ENDPGM) ENDDO GOTO CMDLBL(RETRY) ENDDO CALL PGM(QCMDEXC) PARM(&PARM3 512) ENDDO SNDMSG MSG('The job ' || &JOBNAME *TCAT ' is in + debug mode. Once the job is completed + end debug and the ENDSRVJOB manually.') + TOUSR(&USERID) GOTO CMDLBL(ENDPGM) ENDDO SNDMSG MSG('The job ' || &JOBNAME *TCAT ' + exists more than once in the system. + Kindly cancel the jobs and the + corresponding output and retry the + command again.') TOUSR(&USERID) GOTO CMDLBL(ENDPGM) ENDDO IF COND(&PARM3 *NE ' ') + THEN(DLYJOB DLY(&PARM2)) CALL PGM(QCMDEXC) PARM(&PARM1 512) ENDPGM: ENDPGM Command: BTCHDBGCMD (CMD) CMD PROMPT('Job to Run') PARM KWD(CMD) TYPE(*CHAR) LEN(512) MIN(1) + PROMPT('Program to submit') PARM KWD(DLY) TYPE(*CHAR) LEN(3) DFT(120) + PROMPT('Enter delay time in *SECS') PARM KWD(DBG) TYPE(*CMDSTR) LEN(512) MIN(1) + PROMPT('Enter debug command') PARM KWD(JOBQ) TYPE(*CHAR) LEN(10) DFT(QBATCH) + PROMPT('Enter job queue')Since I can have only one Command String in the program to submit I've Defined as a char string of 512 bytes, and the debug parameter as 512 bytes which is the 3rd parameter. Under the third parameter you use STRDBG command.
[report a broken link by clicking here]