We use self-submitting CL programs to run reports in batch. But when we need to debug the programs, we'd like to stop the CL from self-submitting.
Instead of changing the code temporarily, use a data area in QTEMP whose mere existence makes the CL run interactively. If data area NOBATCH (any type/size) isn't found, the CL self-submits normally.
DCL VAR(&JTYP) TYPE(*CHAR) LEN(1) VALUE('0') /* If running interactively, submit to batch : */ CHKOBJ OBJ(NOBATCH) OBJTYPE(*DTAARA) MONMSG MSGID(CPF0000 MCH0000) EXEC(RTVJOBA TYPE(&JTYP)) DO_SUBMIT: IF COND(&JTYP *EQ '1') THEN(DO) SBMJOB CMD(CALL PGM(THISPGM) PARM(&DATA)) JOB(JOB_NAME) RETURN OD_SUBMIT: ENDDO
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.