|
Hi All,
This problem is about passing parameters through command return values from one
program to another and how they should be defined and handled in both the
program that uses the command and the CPP that processes the return value.
scenario: CL program using a RTV*command that has an ILE RPG as CPP.
The idea is a "keyword=value" parser for an IFS file. I have created a command
with a RTNVAL(*YES) PARM. This returns a value into a variable. The command
gets the filename, the keyword to locate in the file, my return variable and
the length of the return variable. Four in all.
The CPP all defines the fields to their maximum lengths. The maximum length for
a keyword value is 2048 bytes.
The programs I wish to use the command in, defines the variables at their
expected length. The length parameter is passed to avoid writing in unknown
areas. For example, the <TYPE> keyword/value combination in the file returns a
maximum keyword length of 10 positions: "TYPE=PROGRAM, TYPE=FILE, etc". So I
declare the &TYPE var to LEN(10).
I now create a program that uses the command, like so:
RTVQ FILE('/qopensys/etc/file.inf') KEY('TYPE') KEYVAL(&TYPE) KEYVALLEN(10)
I see that my CPP behaves as expected by filling the value of the return value
up to the number of positions provided in KEYVALLEN. Then the program Returns.
The CPP then does some closing things (there is a undebugable section (where
you press f10 several time but nothing seems to happen)) and I get a "Scalar
operand contains a value that is not valid" error (MCH5003). If I extend the
value of &TYPE to 2048 and prefill it with some random value, all runs fine and
the random value is replaced by blanks, even after the position of KEYVALLEN
(as I expected).
I suppose the CPP tries to copy the value of the parameter back into the
returnvalue and crosses some boundary. I hoped that the pointer to &TYPE was
simply passed to the CPP and that the CPP was in charge of that pointer but
that is obviously not the case. Is there some inbetween buffer in the command
space where the parameter is passed by value? I tried to trick this command
space by defining 1 position for the KEYVAL but the OS seems persistent in
copying back all values from the parameter length as defined by the CPP.
The latter indicates that the RPG ILE program wants to return all parameter
info. Which in turn indicates that some proxy field is used to pass the
parameter information rather then the field i define in my PLIST. In the RPGILE
manuals there is a comment stating that "at closing, the factor 2 of the *ENTRY
parm is moved into the result field of the PARM" however, there is no factor 2.
Could it be that a command using an ILE Pgm as CPP is passing command RTNVAL
variables by reference indirect?
When I move a CLP (OPM) in between the ILE and the command doing nothing other
then pass the parameters to the intended CPP, all runs fine.
O Midrange-l, enlighten me!
Wim
www.remain.nl
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.