Holden Tommy wrote:
> 
> OR you could use QCMDEXC instead of worrying about ACTGRP...
> 
>  * Run CL Commands Procedure...
>  * To use this functionality use the CALLP opcode
> DRun              PR                  ExtPgm('QCMDEXC')
> D CmdStr                      3000A   Const Options(*VarSize)
> D CmdLen                        15P 5 Const
> D CmdDBCS                        3A   Const Options(*NoPass)
>  * This are work fields used as parms for the procedure
>  * After you load the Cmd field use Eval CmdStrSize=%LEN(%TRIM(CMD))
>  *   The call will look like this CALLP   RUN(CMD:CMDSTRSIZE)
> DCmdStr           S           3000A   Inz Varying
> DCmdStrSize       S              4P 0 Inz
>  * End Of Run CL Commands Procedure...
> 

You can simplify the calling code, and remove the CmdStrSize definition:

   eval cmdStr = 'ovrprtf  ... '
   callp run(cmdStr : %len(cmdStr))

(Since you used CONST on the prototype, you can code %len directly, and
since you used VARYING on the definition of CmdStr, you don't need the
%TRIM to get the length.)

I agree that using QCMDEXC is better in this case, since it doesn't have
any of side effects that changing the activation group might have.

Anyway, in general, I like QCMDEXC better than system() anyway, because
of way system() handles error messages, even if system() is easier to
call having only the command parameter.  I don't like the way the
message automatically gets taken out of the joblog.  Also see rob's post
in the recent thread "Using CL to call RPG pgms"
http://archive.midrange.com/rpg400-l/200509/msg00149.html.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.