Thank you Barbara. I like simplification when the clarity remains, and
in your case it does.
Referring to your comment (and several others) about %Trim, I still tend
to use it - just a hang over I suppose from working with BASIC and other
languages where the results of string manipulation can be rather
unclear. In general, I tend to lean toward explicit methods instead of
implicit ones...
However, in the example as given I agree with you. Since the command is
set with a literal (vs. a %SUBST or similar) there will be no 'stray'
characters hanging around and the %Trim is un-necessary in this case.
Thanks for the advice.
Jim
p.s I did change my prototype to match Bobs noting not only the
conditional parameter he pointed out but also the advantage of using
CONST and VARYING for this API (like many others).
 
 
In a true zero-defects approach, there are no unimportant items. 
Philip Crosby, Reflections on Quality
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[
mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Friday, 1 June 2007 5:32
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Does Qcmdexc return an error ??
Jim Wiant wrote:
Then when I issue a command I do this:
C                   Eval      MyCmd = 'DSPFD FILE(XYXYXYZ) ' +
C                                     'OUTPUT(*PRINT)'
C                   Eval      MyCmdLen = %LEN(%TRIM(MyCmd))
C                   CallP(E)  QCMDEXC(MyCmd:MyCMdLen)
Jim, if you use Bob's prototype, you can also simplify your calls:
C                   Eval      MyCmd = 'DSPFD FILE(XYXYXYZ) ' +
C                                     'OUTPUT(*PRINT)'
C                   CallP(E)  QCMDEXC(MyCmd:%Len(%Trim(MyCmd)))
And if you define MyCmd as VARYING, you can simplify further by 
eliminating the %trim:
C                   Eval      MyCmd = 'DSPFD FILE(XYXYXYZ) ' +
C                                     'OUTPUT(*PRINT)'
C                   CallP(E)  QCMDEXC(MyCmd:%Len(MyCmd))
-
This message has been sent from Foodstuffs (Auckland) Limited ("Foodstuffs").
The information contained in this message and or attachments 
is intended only for the person or entity to which it is 
addressed and may contain confidential and/or privileged 
material. Any review, retransmission, dissemination or other 
use of, or taking of any action in reliance upon, this 
information by persons or entities other than the intended 
recipient is prohibited. If you received this in error, 
please contact the sender and delete the material from any 
system and destroy any copies.
The views and opinions expressed in this message may be those
of the individual and not necessarily those of Foodstuffs, 
and are not given or endorsed by it.
Please note that this communication does not designate an 
information system for the purposes of the Electronic 
Transactions Act 2002.
As an Amazon Associate we earn from qualifying purchases.