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



In a way, I wish IBM had not used some odd term like *OMIT and had used something like *NULPTR - because that is what is being sent, after all. Don't we have the NULL keyword already? Can that be used instead of *OMIT? As Duane says, *OMIT is like a placeholder - something has to be passed to keep the order intact for parameters farther down the list.

And those "fine" manuals are very useful things to read!

JMNSHO
Vern

Christen, Duane wrote:
David I would look at the design a little more, basically you have:

Parm1 CONST *OMIT
Parm2 CONST *OMIT
Parm3 CONST *OMIT
Parm4 CONST
Parm5 CONST
Parm6
Parm7 *NOPASS

I would do this:
Parm4 CONST
Parm5 CONST
Parm6
Parm1 CONST *OMIT *NOPASS
Parm2 CONST *OMIT *NOPASS
Parm3 CONST *OMIT *NOPASS
Parm7 *NOPASS

The reason is that required parms should come first IMO. Your Parm4 thru Parm6 are required, but Parm1 thru Parm 3 are omissible, thus optional, and Parm7 is optional. The receiving program can easily deal with the omissible/optional parms in its code and the callers only have to pass the required parms and any additional parms needed to get the required results.
So you would always have to call it like:
myPgm(data1 : data2 : error);

If you needed to pass the data structure you would call it like this:
myPgm(data1 : data2 : error : *OMIT : *OMIT : *OMIT : dataStructure);

The special value *OMIT is really saying I don't need to pass a value for this parm, but I need to pass a value for a parm lower in the parameter list, so receiver please ignore this parm and act like I didn't pass it.
Make sense?

Duane Christen.

--


Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Friday, August 21, 2009 8:50 AM
To: RPG programming on the IBM i / System i
Subject: RE: OPTIONS(*OMIT)/style question

-----Message d'origine-----
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Simon Coulter

No I wasn't ... but that can hardly be the first use of RTFM you've seen--even if not directed at you.

Nope, not in all the years I've been on this list. No, I'm not going to look it up in the archives!



Anyway, IIRC, the FM says that the special value *OMIT will
be passed.

Not really. It says that a null address will be passed (paraphrasing but that's the gist of it).

Just re - read :

When OPTIONS(*OMIT) is specified, then the value *OMIT is allowed for that parameter.


I guess that by passing *OMIT, I am expressly stating that
the caller
must not use the parameter. So in my view this seems to be the best way.
No, you are expressly saying the receiver must not use the parameter.
Sorry, that's what I meant.


So, back to my problem.

I've a program

Parm1 CONST
Parm2 CONST
Parm3 CONST
Parm4 CONST
Parm5 CONST
Parm6
Parm7

Parameters 4 5 and 6 are always passed, 6 being an error message. Parm7 represents an optional pointer to data structure. As parameters 1 to 3 aren't always needed I wanted to use *OMIT on these. I have *NOPASS on Parm7. The program knows when which parameters are supposed to be present. As this may be called by many other programs I thought calling like this :

MyPgm ( *OMIT :
*OMIT :
*OMIT :
Parm4 :
Parm5 :
Parm6 );
OR

MyPgm ( *OMIT :
*OMIT :
*OMIT :
Parm4 :
Parm5 :
Parm6 :
Parm7 );

Would make it perfectly clear that parameters 1 to 3 were not to be used.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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 ...

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.