Re: AW: PL/I and optional parameters

2015-11-06 Thread Jon Butler
The name of the program is ESCHATON, and irrespective of the number or value of 
parameters passed, always returns 42.

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


Re: AW: PL/I and optional parameters

2015-11-05 Thread Jerry Callen
> I have a PL/I subroutine call that has 297 optional parameters.  That is the 
> function has a parameter list with up to 100 tuples of parameters.  The first 
> tuple is required, and tuple 2 through 100 are optional.

OK, I've been watching this thread with growing curiosity and I can't stand it 
any longer: What in the world are you doing with a subroutine with that many 
parameters? Is the code that calls this routine machine-generated? I can't 
imagine a human being coding such a call. 

-- Jerry

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


AW: Re: AW: PL/I and optional parameters

2015-11-04 Thread Peter Hunkeler
> The earlier post by Peter Hunkeler was referring to the LIST attribute of 
> ENTRY, described here:
> http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IBM3LR60/6.10.5


Yep, this is what I referred to.


--
Peter Hunkeler



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


Re: AW: PL/I and optional parameters

2015-11-04 Thread Bill Godfrey
On Wed, 4 Nov 2015 11:40:34 -0600, Jon Butler wrote:

>LIST has been part of PL/I, and most high-level languages, since at least the 
>370...that's a far back as I go!
>
>You can use LIST to get an listing of the assembler generated by the PL/I 
>statements in your module.  You can also limit the output by using a LIST(n,m) 
>where n and m are the line numbers in your program for which you want the 
>assembler to be shown.   These are the actual line numbers used by the 
>compiler, not the editor line numbers.  
>
>If you use LIST, you many not want to use OPTIMIZE, so you see the assembler 
>in the same order as your code before the optimizer re-arranges it.

You are referring to the LIST compiler option described here:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IBM3PG80/1.1.1.48

The earlier post by Peter Hunkeler was referring to the LIST attribute of 
ENTRY, described here:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IBM3LR60/6.10.5

Bill

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


Re: AW: PL/I and optional parameters

2015-11-04 Thread Jon Butler
LIST has been part of PL/I, and most high-level languages, since at least the 
370...that's a far back as I go!

You can use LIST to get an listing of the assembler generated by the PL/I 
statements in your module.  You can also limit the output by using a LIST(n,m) 
where n and m are the line numbers in your program for which you want the 
assembler to be shown.   These are the actual line numbers used by the 
compiler, not the editor line numbers.  

If you use LIST, you many not want to use OPTIMIZE, so you see the assembler in 
the same order as your code before the optimizer re-arranges it.

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


AW: PL/I and optional parameters

2015-11-03 Thread Peter Hunkeler

> I have a PL/I subroutine call that has 297 optional parameters.  That is the 
> function has a parameter list with up to 100 tuples of parameters.  The first 
> tuple is required, and tuple 2 through 100 are optional.


[snip]
> Is there a shorter way of declaring 297 optional parameters in PL/I?


You may want to look at the "LIST attribute" of an ENTRY declaration in the 
Enterprise PL/1 Language Reference. It might require the Enterprise edition of 
the complier, I'm not sure it was supported on elder versions of the comiler.


There are builtin funrctions that help you find how many optionals have been 
specified and where they are.


--
Peter Hunkeler





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


Re: PL/I and optional parameters

2015-11-02 Thread Jon Butler
Janet,


I'm not sure, but I think you may be confused about the parameter descriptors 
on the ENTRY statement.  

The descriptors do not limit the parameters passed, but rather they cause any 
parameters to be converted (if required) to dummy variables which match the 
description on the ENTRY statement.   This is one of the "features" of 
PL/I...you can write a single subroutine that handles many different types of 
numeric data passed to it.  (This is not unlike numeric overloading in Java, 
but the PL/I compiler does it for you.).

For example :

DCL MySub ENTRY EXTERNAL (FIXED BIN(15));
DCL x  FLOAT (10); 
DCL y FIXED BIN (15);

x = 2.6532491e2;   
y = MySub(x);

The 2.653249e3 is converted to 265 and passed to MySub and the result of 
MySub's calculation put into y.

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


Re: PL/I and optional parameters

2015-11-02 Thread Janet Graff
Jon,

Is there a way to keep the type checking on the required parameters and also 
allow the trailing parameters to not be specified?

The type checking is extremely useful to my customers and I'd hate to lose it 
completely.  I'd prefer some syntax where I can say 

99(char (*) optional,
  char (*) optional,
  Fixed Bin(31) optional)

or some variation that keeps both the type checking and the number of 
parameters checking.  I can live with losing the type checking on the optional 
parameters, as long as I can keep the type checking on the required parameters.

Janet

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


Re: PL/I and optional parameters

2015-10-28 Thread Jon Butler
You can code the following to allow any number of arguments: the compiler will 
generate the pseudo variables for you.   I'm doing this from memory as I don't 
have access to a PL/I compiler right now so please verify.

Declare myFunc External('VSHPARR') Entry;

If you were to code this:

Declare myFunc External('VSHPARR') Entry( );

It would indicate there are no arguments for the function, say for returning 
the value of some constant such as PI.

PS, I would not use "TUPLE" for a PL/I parameter list, although no doubt the 
.NET and PYTHON people love it.

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


PL/I and optional parameters

2015-10-27 Thread Janet Graff
I have a PL/I subroutine call that has 297 optional parameters.  That is the 
function has a parameter list with up to 100 tuples of parameters.  The first 
tuple is required, and tuple 2 through 100 are optional.

In C the function signature looks like this

int myFunc( int *numDescriptorEntries,
   int *numBufferEntries,
   char *errorBuffer,
   char *descriptor,
   char *Buffer,
   int  *Length,
   ...);

In PL/I I'd like to do this

   Declare myFunc External('VSHPARR') Entry(
   Fixed Bin(31) byaddr, /* Number of Descriptors */
   Fixed Bin(31) byaddr,/* Number of Entries */
   Char(*) byaddr,   /* Error msg buffer */
   Char (*) byaddr,   /* descriptor*/
   Char (*) byaddr,  /*Buffer */
   Fixed Bin(31) byaddr,  /*  Length */
* optional,
   )
   returns( byvalue Fixed Bin(31) )   /* Return code */
   options ( nodescriptor, linkage(system) );


But PL/I flags this call as an error because I need all three "*optional" 
declarations

   rc = myFunc (numDescriptorEntries,
numBufferEntries,
error,
Descriptor1,
Buffer1,
Length1,
Descriptor2,
Buffer2,
Length2);

Which means I have to declare this

   Declare myFunc External('VSHPARR') Entry(
   Fixed Bin(31) byaddr, /* Number of Descriptors */
   Fixed Bin(31) byaddr,/* Number of Entries */
   Char(*) byaddr,   /* Error msg buffer */
   Char (*) byaddr,   /* descriptor*/
   Char (*) byaddr,  /*Buffer */
   Fixed Bin(31) byaddr,  /*  Length */
* optional,
* optional,
* optional
   )
   returns( byvalue Fixed Bin(31) )   /* Return code */
   options ( nodescriptor, linkage(system) );

So for 100 repeats of the tuple, this function declaration is going to get 
quite lengthy with loads of "* optional" parameters.
Is there a shorter way of declaring 297 optional parameters in PL/I?

Thank you!
Janet

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