4

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.

Kunal Roy
  • 729
  • 3
  • 11

1 Answers1

3

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
Bidder
  • 160
  • 6