Steve Comstock wrote:
On 3/23/2012 2:57 PM, Phil Smith wrote:
>>Now for the next question: this allows us to implement variable parameter 
>>lists in C, by declaring the functions thus:
>>int SOMEFUNCTION(char *someparm, ...);

>>Is there an equivalent way to do this in PL/I?

>In the declare of the subroutine, specify the word LIST in the last
>argument descriptor, for example:

>dcl avgyx entry (fixed bin(31),
>  fixed decimal(7,2) optional,
>  char (8),
>  list byaddr)
>  options(asm);

>This indicates there are zero or more arguments from the point
>of the LIST

>Then, in the invocation, pass at least as many arguments as
>arguments before the word LIST and any others you want:

>call avgyx (test_no,
>           weight,
>           test_name,
>           rand_var,
>           score_low,
>           score_high);

Hm. This isn't quite working:

Declare THEFN  External('THEFN') Entry(
         Char(*) byaddr,
         Char(*) byaddr,
         Fixed Bin(31) byaddr,
         Char(*) byaddr,
         Fixed Bin(31) byaddr,
         Char(*) byaddr
        )
        returns( byvalue Fixed Bin(31) )
        options ( nodescriptor );

On compile, this gets RC=4 and:
IBM1214I W      35.0    A dummy argument will be created for argument number
                        4 in entry reference VSHPROT. 

Then it linkedits OK but gets a ABENDU4038 on run. This differs from your 
recommendation by being an EXTERNAL function; I had to use NODESCRIPTOR because 
ASM isn't supported for functions, apparently.

Ideas?
--
...phsiii

Phil Smith III
p...@voltage.com
Voltage Security, Inc.
www.voltage.com
(703) 476-4511 (home office)
(703) 568-6662 (cell)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to