The QCAPCMD API returns error information where QCMDEXC does not.
The QCAPCMD API returns error information where QCMDEXC does not.
Just code an ERROR indicator on the CALL (or CALLP(e) in RPG IV). If the error indicator turns on, the command failed. Chris
Hi, use the (E)-Extender on the call statement and define the Program Status Datastructure in your RPG Program: D PGMSTA SDS D MsgText 91 170 Message-Text If you get an Error in your CL command you get the Message-Text in MsgText For example to check object existence: C eval P$cmd = 'CHKOBJ OBJ(' + %Trim(P$PGM) + ') '+ 'OBJTYPE(*PGM)' C callp (E) Qcmdexc(P$Cmd: %Len(P$Cmd)) C if %Error C eval MsgId = 'CPF9898' C eval MsgData= MsgText C eval MsgFile= 'QCPFMSG *LIBL' C exsr SndPgmMsg C endif Birgitta
Dear Mark, Do you know where I can find which parameters QCAPCMD take? I would really like to try it out. I know it takes 9 parameters but I don't know the format of them. Thanks a lot. BR Jörgen
I'm using the API QcmdExc to run CL commands from an RPGIV program. This works great until there is a CL error. Is there a way to "Monitor Msg" from my RPG as well? Thanks for any ideas.
Sure, here is an example. Mark
Code