Figure 2: Executing commands with 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)
|
A |
D NullString C -1
D Success C 0
D Returncode S 10I 0
D User S 10 Inz(*User) Varying
/Free
Returncode = Gocmd('WRKSPLF SELECT(' + User + ') OUTPUT(*PRINT)');
Select;
When Returncode = Success; // Command was successful
...
When Returncode = NullString; // Command string was null
...
Other; // Command failed
...
Endsl;
/End-free |