Figure 3: Capturing an error message from the system() function
|
/If Defined(*Crtbndrpg)
H Dftactgrp(*No)
/Endif
H Bnddir('QC2LE')
// ------------------------------------------------------- Prototypes
D GoCmd PR 10I 0 Extproc('system')
D CmdString * Value
D Options(*String)
D NullString C -1
D Success C 0
|
D ObjectNotFound C 'CPF3142'
D ObjectInUse C 'CPF3156'
|
|
D Errmsgid S 7 Import('_EXCP_MSGID')
|
D Returncode S 10I 0
/Free
Returncode = Gocmd('DLTF MYLIB/MYFILE');
Select;
When Returncode = Success; // Command was successful
...
When Returncode = NullString; // Command string was null
...
|
When Errmsgid = ObjectNotFound; // CPF3142
...
When ErrMsgid = ObjectInUse; // CPF3156
...
Other; // Some other error
...
|
Endsl;
/End-free |