|
Thanks Chuck. This works perfectly!
I also found the article below.
http://www.itjungle.com/fhg/fhg112906-story01.html
CRPence on Tuesday, April 16, 2013 10:27 AM wrote:
On 15 Apr 2013 14:11, Stone, Joel wrote:
I would like to create a command to accept a parm of any length.
Must I use VARY(*YES) in the CMD source?
Do I then have to check the 1st two bytes of the parm for the
length?
Yes. The number of bytes of the integer length type *INT# that was
specified for Value Length [second element of the VARY()
parameter].
If I state the LEN(500) as the max length, I would like any CL
pgm to use the command with a parm of any length 500 or less.
Normally a program would always declare the same length as the
invoked program to prevent any issues due to parameter length
mismatches. As long as the *VARY parameter is only ever received by
the CPP vs any other CALLable interface, then all can work well.
But the calling pgm forces me to pass a parm of length 500.
Such a restriction was never enforced in older releases. I would
be hesitant to accept that as accurate... without some error
message describing what is meant.
I have tried VARY(*YES), but it seems to not work well.
What is required in addition to VARY(*YES)?
Both "forces" and "not work well" are nebulous. Any concrete
examples? Hopefully my example below will cover what is being
attempted.
Nothing more than VARY(*YES) is required on the *CMD. But then one
must code the CPP to properly handle and use the additional data;
i.e. the declaration in the CPP would be for 502 bytes vs 500, to
accommodate the length value that precedes the character data. And
the CPP should use that Length Value to access only that much of
the passed character data in the field [e.g. via %sst]; i.e.
neither the entire 500-byte component nor the overall 502-bytes of
the full variable should ever be accessed.
Treat the PARM as input-only and look only at the data up to the
length provided, and there should be no difficulties. See the
following example <<SNIP; see the archives>>
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.