× 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.



David,

I don't think there is any easy answer.  What is really fun is when
parameters in the middle may be missing, then your example of checking the
number of parameters is irrelevant.  For example, I wrote a command in
which the cpp is an rpgle program.  The name of the command is RTVJOBD.
Here is a screen shot:

                      Retrieve Job Description (RTVJOBD)
Type choices, press Enter.
Job Description  . . . . . . . . > MYJOBD        Name
  Library  . . . . . . . . . . .     *LIBL       Name, *LIBL
Job queue name . . . . . . . . .                 10 A
Job queue library name . . . . .                 10 A
Job priority (on JOBQ) . . . . .                 2 A
Output priority (on OUTQ)  . . .                 2 A
Print device . . . . . . . . . .                 10 A
Output queue . . . . . . . . . .                 10 A
Output queue library . . . . . .                 10 A
Text 'description' . . . . . . .                 50 A
User . . . . . . . . . . . . . .                 10 A
Print text . . . . . . . . . . .                 30 A
Accounting code  . . . . . . . . > &ACTCOD       15 A
Routing data . . . . . . . . . .                 80 A
Request data or command  . . . .                 256 A
CL syntax check  . . . . . . . .                 2,0

More...
F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display
F24=More keys
Command RTVJOBD not allowed in this setting.

Sorry that the underlines don't appear in the paste.  But if you use the
above, you'll have two parameters, but don't assume they are positional.  I
have to check each variable
If %addr(thisvar)=*null
 // then don't process it.
...

Source available upon request.  It is a few years old, however.

Rob Berendt

==================
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin



                    David Gibbs
                    <dgibbs@mks.com>        To:     "'RPG400 Mailing List'" 
<RPG400-L@midrange.com>
                    Sent by:                cc:
                    rpg400-l-admin@mi       Fax to:
                    drange.com              Subject:     Using *OMIT & *NOPASS


                    11/28/2001 10:56
                    AM
                    Please respond to
                    rpg400-l






Folks:

I've got a bit of a quandary... We've been writing a number procedures that
have a variable number of parameters.

These procedures, in turn, call other procedures that also have a variable
number of parameters.  The two procedures have very similar (if not
identical) parameter lists ... but the called parameter might call a
different procedure based on a control file.

I made the erroneous conclusion that if a parameter was not passed, it's
address would be set to *NULL (similar to passing *OMIT).

So, the question is ... what is the best way to handle possibility unpassed
parameters without having to code a complex structure of "if %parms > 2,
call w/ 3 params, if %parms > 3, call w/ 4 params", etc?

Here's a quick pseudocode of what we are doing...

Program Z

callp x(a,b)

end pgm z

Proc X (a, b *nopass, c *nopass)

if control file say one thing
           return Y (a,b,c)
else
           return W (a,b,c)
endif

end proc X

Proc Y (a, b *nopass, c *nopass)

do stuff

end proc Y

Proc W (a, b *nopass, c *nopass)

do other stuff

end proc Y


david

--
David Gibbs
Sr. Software Engineer
MKS, Inc.
2500 S. Highland Ave, Suite 200
Lombard, IL  60148
(630) 495-2108 x5004

Need a laugh (we all do these days): visit http://www.userfriendly.org

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.