Reputation: 787
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.
Upvotes: 4
Views: 463
Reputation: 320
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
Upvotes: 4