|
>> Here is a method to execute any system command using the C function 'system'
instead of QCMDEXC.
Scott - this works well but there is one problem and one addition that I would
make. As you'll see from the version below the correct RPG IV interpretation of
"int" is a 10I (i.e.4 byte field) not 5I (2 byte). I think most times your
version will work although I'm darned if I know why! The extension I would make
involves the use of the exported field _EXCP_MSGID which on failure (indicated
by a returned value of 1 although I have "cheated" and simply tested for
non-zero) will contain the exception message Id.
H DftActGrp(*No) BndDir('QC2LE')
D OK C 0
D ErrorCode S 7A Import('_EXCP_MSGID')
D SystemCmd Pr 10I 0 ExtProc('system')
D CmdString * Value Options(*String)
C If SystemCmd('cpyf fred joe') <> OK
C ErrorCode Dsply
C EndIf
C Eval *InLR = *On
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.