|
Well I got to reading some more while coding something else so I could be
off but this is what I think.
Don't want to use %size(QCMD) because thats 3002.
CONST
The parameter is passed by "read-only reference"(Need because calling
program). A parameter defined with CONST must not be modified by the
called program or procedure(It doesn't). This parameter-passing method
allows you to pass literals and expressions(I have built with Eval).
*varsize "The parameter may contain less data than is indicated on the
definition.(I
want this - Eval changes length of QCMD literial) This keyword is valid
only for character parameters(Have this), graphic parameters, UCS-2
parameters, or arrays passed by reference. The called program or procedure
must have some way of determining the length of the passed
parameter.(%len(QCMD) does this on second parm Len)"
For Value question found answer in archive thanks Scott K.
LEN 15S 5 needs to be a CONST because "When calling a PROGRAM
"(EXTPGM(QCMDEXC)is a program)" (as opposed to a
procedure) you MUST pass by reference. CONST is allowed, as that it is still
by reference."
Look for "parameters - const, value, reference" in archive alot better than me
at explaining.
Thanks
Bill Hopkins
Hans Boldt <boldt@xxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
08/20/2003 03:21 PM
Please respond to RPG programming on the AS400 / iSeries
To: rpg400-l@xxxxxxxxxxxx
cc:
Subject: Re: QCMDEXC on v5r1
Bill Hopkins wrote:
> *
> D Qcmdexc pr Extpgm('QCMDEXC')
> D Cmd Like(Qcmd) Options(*Varsize) Const
> D Len 15p 5
> D Opt 3 Options(*NoPass) Const
>
> D Qcmd s 3000
>
>
> Later in code
>
> *
> C Eval Qcmd = 'CPYTOIMPF FROMFILE(FXC'+
> C ')TOSTMF(''qdls/forcastx/fxc.t'+
> C 'xt'') MBROPT(*REPLACE) STMFCO'+
> C 'DPAG(*PCASCII) CDDLM(*OPT(*RE'+
> C 'PLACE) STMFCODPAG(*PCASCII) C'+
> C 'DDLM(*CR) DTAFMT(*DLM) STRDLM'+
> C '(*NONE) FLDDLM(X''05'')'
> *
> C CallP Qcmdexc(Qcmd:%Len(%Trim(Qcmd)))
>
>
> *RNF7542 30 1 Parameter cannot be passed by reference when it can
be
> changed during the call.
>
>
>
> Thought I had seen something like this on list a few times, did I miss
> something, or is this v5r2.
> I'm at v5r1.
>
Add keyword CONST to parameter LEN. As coded, LEN is passed by
reference, but you need to specify a variable name for a reference parm.
Cheers! Hans
_______________________________________________
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-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.