2 replies Latest Post - ‏2014-08-25T15:41:19Z by Frank_O_Myers@IBM
12 Posts

Pinned topic Calling PL/I from COBOL with variadic arguments

‏2014-08-14T20:40:43Z |


I have a PL/I routine for processing (formatting & writing) messages. It takes a variable number of arguments via the "LIST" attribute on the last declared argument.

This allows me to use VARGLIST() and VARGSIZE() builtin functions to step through the optional parameters. This all works.


Now I am trying to call this from a COBOL program, but once I added the OPTIONS(COBOL) I get compiler errors telling me that the LINKAGE is incompatible with the "LIST" attribute.

Normally, when I run into restrictions it's easy to figure out why they exist (and sometimes get past them).

This one has me stumped. I know that COBOL does not directly support variable length parameter list, but it also does not prohibit them.

From COBOL, you can call an external entry point any number of times, passing a different number of arguments each time. It's up to the called program to correctly handle the variadic data.

Why is LIST (variadic parameters) prohibited for COBOL linkage in PL/I?

Is there another way to accomplish this?


  • Frank_O_Myers@IBM
    12 Posts

    Re: Calling PL/I from COBOL with variadic arguments

    ‏2014-08-15T16:05:48Z  in response to Frank_O_Myers@IBM

    I removed the LIST attribute, and now pass the last argument as POINTER BYVALUE, and will try getting it's address and stepping past it to retrieve the next parameter using


    This should (I hope) allow me to retrieve sucessive full-word pointers or values from the caller's parameter list.

    Updated on 2014-08-15T18:50:36Z at 2014-08-15T18:50:36Z by Frank_O_Myers@IBM