I recall having programmed my own functions with variable numbers of parameters in the past and am faced with a situation here where being able to do that would save large amounts of run-time; but I can't recall how I did it and haven't found anything on the web about this. Does anyone here know how this might be accomplished?
Thanks in advance,
DataStage BASIC functions with variable number of arguments
Moderators: chulett, rschirm, roy
I suppose that might be an option - but in my case I'd be calling this function from a transform stage and we can't put DIM statements to allocate an array; a dynamic array might work but would be quite unwieldy in this case. I think if I can't get a variable number of arguments sorted out I'll have to resort to something completely different.
I think making a variable number of options involved a special declaration in the code or the compiler options; and then you had to use ASSIGNED() to figure out which arguments had been passed into the function. And all the internal programs which I might use to see what they had done have been compiled with the -I option so that they cannot be VLISTed
I think making a variable number of options involved a special declaration in the code or the compiler options; and then you had to use ASSIGNED() to figure out which arguments had been passed into the function. And all the internal programs which I might use to see what they had done have been compiled with the -I option so that they cannot be VLISTed
What about creating the routine as taking a fixed number of parameters and then putting a series of transforms over the top of it that take your 'variable number of arguments'. The transform could default / hard code the 'unused' parameters in that case. 
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig,
that's a good approach, I like that idea and hadn't approached it from that angle. But in this it wouldn't work because of the extra performance overhead, this routine gets called ~100 Million times per day so I am trying to tweak performance out of the common call. I found that by adding/removing just 2 parameters the CPU overhead gets changed by over 10%.
that's a good approach, I like that idea and hadn't approached it from that angle. But in this it wouldn't work because of the extra performance overhead, this routine gets called ~100 Million times per day so I am trying to tweak performance out of the common call. I found that by adding/removing just 2 parameters the CPU overhead gets changed by over 10%.
I think that I might steer away from variable number of arguments even if I do get an answer; since it is most likely not fully documented. I think I will now have one routine with 12 parameters called one time per stage to set up all the environment, then for each of the ~100million daily rows will call the "real" function with just 2 parameters.
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I think Ken was referring to the ol' dynamic array as an argument trick. (Indeed, you can use any delimited string, but a field-mark delimited dynamic array gives you more flexible parsing options as well as the hint mechanism for extra speed.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
</a>