|
I find that using system() you can tell if the command failed with the error flag, and with what cpf message D As400cmd PR 10I 0 ExtProc('system') D CmdText * Value Options(*String) D D ErrorCPF S 7A Import('_EXCP_MSGID') D ErrorFlag S 10I 0 Inz(0) with C eval Errorflag = As400cmd('CHKOBJ - C QTEMP/UPSELLWRK *FILE') C if ErrorFlag = 0 C eval Errorflag = As400cmd('CLRPFM - C QTEMP/UPSELLWRK') C else C exsr Crtupsellwrk C endif Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx rpg400-l-bounces@xxxxxxxxxxxx wrote on 11/27/2006 02:11:31 PM:
and I believe that qcmdexc updates the psds better. What operational benefit is there to system()? Default activation group? Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Barbara Morris <bmorris@xxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 11/27/2006 01:30 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To rpg400-l@xxxxxxxxxxxx cc Subject Re: Happy Thanksgiving, and a quick question James H H Lampert wrote:... I found that prototyping and calling the C "system()" function was better suited to the problems at hand than calling "QCMDEXC," since "system()" doesn't blow up if the command fails ...You can use a CALL(E) or CALLP(E) on the call to QCMDEXC to stop it blowing up your program. callp(e) qcmdexc(cmd : %len(cmd)); if %error; ... (Broken-record alert) I prefer QCMDEXC() to system() because QCMDEXC() leaves the exception message in the joblog, which makes it much easier to debug in cases where you get an unexpected exception. With system(), you only get the message ID, you don't get the replacement values. And once your program has ended, you don't even have the message id unless you logged it somewhere. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.