Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
I have been working on finding a bug today with another developers function and I am trying to write this up in some documentation.
Someone coded a function call like this:
Callp prProcedure( MyVariable :%Len(MyVariable) :MyVariable);
Then they couldn't figure out why the function was returning blanks when MyVariable was being passed in through the first parameter with a value. They expected a value to be returned and loaded into MyVariable through the third parameter.
The problem was that the function cleared the first parameter before it did any processing and therefore MyVariable was blank when it came time to process it.
What I am trying to remember is if there is a name for duplicating variables on a call to a program or procedure. Does anyone recall if there is a name for sharing a variable across multiple parameters?
No there is not.
what you can do however is to use the VALUE keyword on your 3rd parameter. This will force the compiler to create a temp variable and therefore appear as 2 distinct parameter values.
VALUE wasn't an option since *VARSIZE was used. I actually know how to fix it, just trying to document it and I didn't know if there was a name for sharing variables across multiple parameters.
THANKS!