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




Personally, I think it's bad design to pass output parms in the parm list.
(not saying that i haven't done it). Procedures allow you to return a
value so why not use the return functionality. This may not be the best
solution, but when I have a procedure that needs to return two values, I
just return a data structure.

ie.

D GetRecipeID PR Like(GetRecipeDS)
D iCono 3 Const
D iCpy 3 Const
D iItem 9 Const
D iParent 9 Const Options(*NOPASS)

D GetRecipeDS DS
D RecipeID 11 0
D RecipeQTY 17 6

/Free
// Main pgm

GetRecipeDS = GetRecipeID(pGLCPY:pCpy:PosItem:' ');

/End-Free
P GetRecipeID B
D GetRecipeID PI Like(GetRecipeDS)
D iCono 3 Const
D iCpy 3 Const
D iItem 9 Const
D iParent 9 Const Options(*NOPASS)

D Parent S 9
D Item S 9

D rtnRecipeDS DS
D Recipe 11 0
D Quantity 17 6
/Free

Item = iItem;
Parent = *Blanks;
If %Parms() >= 4;
Parent = iParent;
EndIf;

// cumbersome code removed....


Recipe = NKRCP;
Quantity = NKQTY;
Return rtnRecipeDS;
/End-Free
P GetRecipeID E


Michael Schutte
Admin Professional



We've wrapped up a whole new breakfast adventure in Bob Evans BOBurrito.
Premiering at 5.99. For more information and to enter the FREE Breakfast
Every Week for a Year Sweepstakes ($500 value), visit www.BOBurrito.com


rpg400-l-bounces@xxxxxxxxxxxx wrote on 03/16/2009 12:57:21 PM:

Thanks. I feel that makes for a messy procedure interface when the
original procedure was designed with input parameters followed by
output parameters, then someone sticks a nopass input on the end,
and later someone else a nopass output parameter.

Is there anything wrong with my suggestion?

-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] De la part de Michael_Schutte@xxxxxxxxxxxx
Envoyé : lundi 16 mars 2009 17:44
À : RPG programming on the IBM i / System i
Objet : Re: New parameter needed for a subprocedure

I think I understand what you want. Here's my suggestion.

In the prototype and interface, add the new parm and make it the last
parm. Use options(*Nopass) on the keyword of this new parm.


D SomePRC PR
D Parm1
D pNewParm 1 Options(*NOPASS)

D SomePRC PI
D Parm1
D pNewParm 1 Options(*NOPASS)

D NewParm S

/Free

NewParm = *Blanks;
If %Parms() >= 2;
NewParm = pNewParm;
EndIf;

/End-Free



Then you can change only the program(s) that need to pass that new parm.
All others remain as is.

Michael Schutte
Admin Professional



We've wrapped up a whole new breakfast adventure in Bob Evans BOBurrito.
Premiering at 5.99. For more information and to enter the FREE
Breakfast Every Week for a Year Sweepstakes ($500 value), visit www.
BOBurrito.com


rpg400-l-bounces@xxxxxxxxxxxx wrote on 03/16/2009 12:32:05 PM:

A new parameter is needed by one of the callers of an exported sub
procedure.

Is there any harm in doing this :

Initialize the value of the new parameter in the exported sub
procedure.

Add a new exported subprocedure GetNewParameter that returns
NewParameter.

The caller that needs the parameter continues to call the original
subprocedure as before and then calls GetNewParameter.

Other callers remain unchanged.

Does this make sense or is this just being lazy and are there any
risks of it going wrong?

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

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

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.