I have issued a CL command in a RPGLE program using the QCMDEXC api. Suppose the CL command throws an error. Is there any way of capturing the error without using the MONITOR.
You can use the "e" code extender
    *  Setup QCMDEXEC
    C                   eval      cmdStr = 'CALL PGM(DMACCT001) PARM(REGIONA)'
    C                   eval      cmdLen = %len( cmdStr )
    C* call to QCMDEXC
    C                   callp(e)  command(cmdStr : cmdLen)
    C                   if        %error
    C*    ZZZ    Friendly error handler goes here
    C                   endif
D Command         PR                  ExtPgm('QCMDEXC')
D  CmdStr                    32702    const options(*varsize)
D  CmdLen                       15p 5 const
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With