Page 1 of 1

Adding Arguments to heavily used existing routine

Posted: Wed Feb 11, 2009 12:46 am
by tracy
We've got a routine with 5 arguments that's used in a lot of our jobs.

We would like to add another argument to this routine, but don't want to have to go in and modify all the jobs that currently call it. We'd rather just let a default value kick in if a value isn't provided.

But we are having a hard time trying to figure out how to do it without causing abortions in the jobs that refer to it.

My only thought at this point is to create a copy of the existing routine and add the new argument to this new routine. Then change the existing routine to simply call the new routine and supply a default parameter to the new argument.

Are there any other options?

Posted: Wed Feb 11, 2009 4:55 am
by ray.wurlod
Create a six-argument routine that is an interface to (that is, which calls) the five-argument routine. That is an easier approach to supplying the default value.

Posted: Wed Feb 11, 2009 10:44 am
by tracy
I want to add the 6th argument and have the routine behave differently based on the value of it.

If I create a six-argument routine that simply calls the five-argument routine, what happens with that 6th argument? It can't be passed to or handled by the five-argument routine.

So I think I'm on the same page as you (having one routine call another), I just appear to be reading it the wrong way. I think I change my original five-argument routine to simply call a new six-argument routine.

Can you straighten me out?

Posted: Wed Feb 11, 2009 4:10 pm
by ray.wurlod
If you want different behaviour WITHIN the old routine then your way is to be preferred.

An alternative might be to load the sixth value into the job's user status area and have the routine pick it up from there.

Posted: Wed Feb 11, 2009 6:18 pm
by tracy
Thanks, Ray! You are awesome!