Just wanted to add my voice to Rob's...

Replacing a parameter list with a data structure is a really bad idea and a bad practice. It made sense in 1993 when we didn't have prototypes, but it makes no sense today!

You're making your program just about impossible to call from anywhere else besides RPG. You're weakening your encapsulation, which makes it more work to support the application. When you do use RPG, you're throwing away most (if not all) of the features added to prototypes over the last 13 years.

And that includes the ability to declare parameters as *OMIT and *NOPASS, which was the whole point behind the thread.

rob@xxxxxxxxx wrote:
I just don't see why I'd want to change from using multiple parameters to using a data structure. Ranks up there with replacing my externally defined files with internally defined ones with large unused spaces at the end "for growth".
When I use multiple parameters I can:
- Check for validation using many of the keywords like CONST.
- Get better clarity by using many of the keywords like CONST.
- Make it easier to execute from a custom command.
- Instead of having to refer to some definition specs to see what might be in this like
screenPrice=currentprice(someFunkyDS);
I can use
screenPrice=currentprice(iprod, qtyordered, custnbr);
and I don't have to remember to zero out some data structure field to use the same one as
screenPrice=currentprice(iprod, qtyordered);
- Make it easier to convert a subprocedure with a return value into a sql UDF so I can do something like
SELECT IPROD, CURRENTPRICE(IPROD, QTYORDERED, CUSTNBR) FROM ORDLINE

That last reason is one huge reason that I would like to convince some developers here to stop making little programs all over the place but instead use a service program and subprocedures. If they insist on using it "the old fashion way" then they could make a simple old program that accept parameters then uses the subprocedure out of the service program. And, yes the service program should come first instead of having the subprocedure in the service program call the old program. Why should the new way take the performance hit of calling an OPM program?

Rob Berendt


This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2019 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].