I only happened to learn PL/I this weekend, so take this with a grain of salt, 
but can't you activate THEFUNCTION with a call rather than as a function in 
order to be able to use LINKAGE(SYSTEM)?  And then use PLIRETV() in order to 
get the return code?

declare THEFUNCTION entry options(ASM RETCODE LINKAGE(SYSTEM));
(I think LINKAGE(SYSTEM) is redundant here.)


call THEFUNCTION(one, two, three);
display(pliretv());
call THEFUNCTION(one, two, three, four, five);
display(pliretv());

(Not sure if the declare entry requires the parms to be declared.)


Maybe you can even wrap the above into a PL/I function so that your PL/I 
programs can invoke it as a function.

Just a WAG.  Good luck!

Frank



----- Original Message -----
> From: Phil Smith <[email protected]>
> To: [email protected]
> Cc: 
> Sent: Tuesday, April 10, 2012 9:57 AM
> Subject: Re: PL/I with variable PLISTs (was: LE C calling HLASM)
> 
> Steve Comstock wrote:
>> I'm confused here, because the title of the thread
>> is 'C calling HLASM' and here we are talking about
>> PL/I.
> 
> Yeah, true...topic drift. Renamed.
> 
>> So what's really going on here that is the mystery?
> 
>> My guess is: you have a C function that you want to
>> call from, in this instance, a PL/I program. Right?
> 
> Right.
> 
>> Can you show us the definition of the C function
>> (not the body, just the definition of parameters
>> along with any pragma statements you might have,
>> and compiler options relevant to calls / function
>> references)?
> 
> See below.
> 
>> Can you show us how you invoke the function from
>> C, COBOL, and Assembler? That is, some sample calls
>> or function references that work successfully, both
>> with two arguments and four arguments (BTW: do you
>> allow the output buffer to be specified without the
>> last length argument? How about no output buffer
>> but with a length? In other words, must the user
>> specify exactly two or exactly four arguments?)
> 
> The previous post had an example from COBOL; C is the same, only in C syntax. 
> Assembler too. We validate that we got three or five arguments (note there's 
> an initial, required argument).
> 
>> Finally: there are some differences in the Enterprise
>> PL/I compiler regarding compile time options and
>> options available for declaring functions and
>> subroutines so I ask this: is your expectation that
>> your customers will be running the Enterprise PL/I
>> compiler or some earlier compiler?
> 
> Here's a C prototype, with the serial numbers filed off:
> 
> int THEFUNCTION( char *magic,
>              char *inputBuffer,
>              int  *inputLength,
>              ...)
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to