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



Thanks Scott.  I forgot that it has no const keyword, which means that
compiler will force the caller to pass the exact same type of variable.



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, October 25, 2006 3:00 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Parameters passed not what is received


I've never declare a parameter with both varying and options(*varsize)

keywords.  What is the purpose/benefit of declaring parameter that a 
way.
    d                               40a   Varying Options(*VarSize)

I strongly disagree with you.

What's the benefit? When you're writing a program or procedure that is
to be called from many different programs, you should design your
procedure to be as easy to call as possible. If you have to do extra
work to convert data, you should do it in the procedure -- after all,
you're going to write the subprocedure ONCE and you're going to call it
MANY TIMES.  Why make every caller do variable conversions before
calling your program?!

Let's say I've written a procedure that translates EBCDIC to UTF-8. It's
used by 10 programs on my system.  One program wants to translate
addresses, and stores those addresses in 3 fields, each 35A VARYING. Why
should that program have to convert it to 40A VARYING to call my
subprocedure?  Wouldn't it be nice if the subprocedure could handle
different sizes besides 40A VARYING?

At the same time, a second program has a line of text that's 80A
VARYING. 
Now it has to split it into 2 fields, each 40A VARYING and call the
subprocedure twice.

Another program has a 1A VARYING field that it wants to convert.  Now it
has to move that 1A VARYING to a 40A VARYING, call my procedure, then
convert it back.

If I had used OPTIONS(*VARSIZE) I could've allowed any size field to be
passed.  One subprocedure that's usable from anywhere.

So why do you object to that?
--
This is the RPG programming on the AS400 / iSeries (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 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.