On 3/30/2012 2:01 PM, Phil Smith wrote:
Steve Comstock made some helpful suggestions; my big problem was having a comma before
the "LIST" keyword. Making progress but not there yet.
So now I have:
Declare MYFUNC External('MYFUNC') Entry(
Char(*) byaddr,
Char(*) byaddr,
Fixed Bin(31) byaddr
list
)
returns( byvalue Fixed Bin(31) )
options ( nodescriptor );
So that compiles and runs, BUT it appears not to be setting the high bit on
the last parameter. So if I issue:
rc = MYFUNC(parm1,
input,
inputLength,
output,
outputLength,
error);
I get RC=0 and the input has been processed to the output as expected.
But if instead I issue:
rc = MYFUNC(parm1,
input,
inputLength);
which works from COBOL, the function should put the output in the input
buffer. It doesn't: if I make the "short form" call first, it complains that the
output length is too long. If I make the "long form" call first, then reset the
output buffer to a known value and issue the "short form" call, I get RC=0 *and
the output buffer has been updated as if I'd specified it*. That made me think
the old parameter value is lying around in the work PLIST used by the compiler,
and the high bit isn't getting set.
Ah HAH, sez I, after searching for "high-order bit": LINKAGE(SYSTEM) is what I
need! Nope:
IBM2019I S 9.1 Unsupported LINKAGE used with the LIST attribute.
So if you can't use LIST with LINKAGE(SYSTEM), how is the called routine
supposed to know the end of the plist?
--
...phsiii
Phil Smith III
[email protected]<mailto:[email protected]>
Voltage Security, Inc.
www.voltage.com<http://www.voltage.com>
(703) 476-4511 (home office)
(703) 568-6662 (cell)
Well, Phil, one way is to use the built in functions I mentioned
in one of my posts:
The address of the first of these additional parameters may
be obtained via the VARGLIST built-in function. This address
may be used to obtain the addresses of any additional parameters as follows:
* if the additional parameters to this procedure were passed BYVALUE,
successively incrementing this initial address by the value returned
by the VARGSIZE built-in function will return the addresses of any
additional parameters
* if the additional parameters to this procedure were passed byaddr,
successively incrementing this initial address by the size of a
pointer will return the addresses of any additional parameters
so you could use VARGLIST and VARGSIZE
Another option is to have one of your entries in the
variable list contain a reserved end-of-list value
(typically f'-1' or f'0')
another option is to have your first entry in the
variable part of the list be a count of how many
additional parameters are being passed this time.
--
Kind regards,
-Steve Comstock
The Trainer's Friend, Inc.
303-355-2752
http://www.trainersfriend.com
* To get a good Return on your Investment, first make an investment!
+ Training your people is an excellent investment
* Try our tool for calculating your Return On Investment
for training dollars at
http://www.trainersfriend.com/ROI/roi.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN