× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On 17/03/2006, at 3:25 AM, James H H Lampert wrote:

What I meant was optional parameters to the program
itself. Not to a prototyped procedure call within it.

You can do either. Prototyping just makes it easier to specify the optional ones. Note that you can prototype program calls as well as procedure calls. CALLP means Call with Prototype. It does not mean Call Procedure.

Although both programs and procedures allow optional parameters only procedures allow omissable ones.

Certainly an easy enough thing to do with MI or C. But I
don't recall whether or not it's doable in RPG.

Whether a program object allows a variable parameter list depends on how it was compiled. Some languages, such as MI, let the programmer decide, others, such as CL, force a fixed parameter list, and still others, such as RPG, make all parameters optional.

DSPPGM will generally show you whether a program allows optional parameters. A single number means a fixed parameter list; two numbers mean a variable list with the first number being the minimum, or required, parameters and the second number being the maximum.

CL Program:
Program statistics:
  Number of parameters . . . . . . . . . . . . . . :   5       

RPG Program:
Program statistics:
  Number of parameters . . . . . . . . . . . . . . :   0       6  

MI Program:
Program statistics:
  Number of parameters . . . . . . . . . . . . . . :   1       3  

If observability has been removed you won't see this information.

ILE programs all allow optional parameters. They show:

Program statistics:
  Number of parameters . . . . . . . . . . . . . :   0            255 

I've already figured out another way of doing what's
needed, and I'm going to run an experiment to see what
happens if you call a program with fewer parameters than
specified, but I'm still curious. Perhaps morbidly so.

If you call a program with less than the minimum or more than the maximum number of parameters you will get:
 Message ID . . . . . . :   CPD0172
Message . . . . : Parameters passed on CALL do not match those required.

followed by:

 Message ID . . . . . . :   CPF0001
 Message . . . . :   Error found on CALL command.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.