Return to the CL Tips
Retrieve program stack
This utility only allows you to retrieve the currently running program in the call stack. Fortunately, this is all we need most of the time.
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(20) DCL VAR(&PGM) TYPE(*CHAR) LEN(10) DCL VAR(&PGMLIB) TYPE(*CHAR) LEN(10) DLTF FILE(QTEMP/NOTFOUND) MONMSG MSGID(CPF2105) EXEC(DO) RCVMSG MSGTYPE(*EXCP) ENDDO OVRDBF FILE(QPPGMDMP) TOFILE(QTEMP/NOTFOUND) DMPCLPGM MONMSG MSGID(CPF0570) EXEC(DO) RCVMSG MSGTYPE(*DIAG) RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) CHGVAR VAR(&PGM) VALUE(%SST(&MSGDTA 1 10)) CHGVAR VAR(&PGMLIB) VALUE(%SST(&MSGDTA 11 10)) ENDDO DLTOVR FILE(QPPGMDMP)
[report a broken link by clicking here]