Page 1 of 1

more than one argument in routines

Posted: Wed Oct 11, 2006 1:30 pm
by tostay2003
Cant we have more than one argument for Before/After Subroutines. If not, they why does the RoutineActivity stage say that it can pass more than one argument?

Posted: Wed Oct 11, 2006 1:49 pm
by roy
Hi,
The Arguments are InputArg and ErrorCode, this doesn't mean the InputArg can't be an array of parameters and their values that you can deconstruct to variables inside the routine or use predefined common area variables.

IHTH,

Posted: Wed Oct 11, 2006 2:09 pm
by meena
Hi tostay2003,
We can gave more than one argument in Routines.

Posted: Wed Oct 11, 2006 2:14 pm
by ArndW
Meena, you can specify optional arguments in user routines; but the number of parameters used in Before/After job routines as in the original post is fixed and you cannot change that.

Posted: Wed Oct 11, 2006 3:12 pm
by ray.wurlod
InputArg receives the contents of the Input Value field from wherever the subroutine was invoked. This might be a delimited string, that can be parsed within the subroutine code.

Posted: Thu Oct 12, 2006 7:41 am
by tostay2003
Which way is preferred, to use routine activity with 3 or 4 parameters concatenated (slight messy as each parameter is derived from a lengthy function) or a job with code in job control (will atleast split the messy parameter list into 3 or 4)

Posted: Thu Oct 12, 2006 7:52 am
by ArndW
I used to use job control extensively, but that was before sequences existed, now I think it is better for maintenance purposes to use a before/after routine and pass the parameters via one long dynamic array. DataStage is very, very efficient with strings so I wouldn't worry about the length.

Posted: Thu Oct 12, 2006 1:51 pm
by ray.wurlod
A Routine activity can only access a routine whose type is "transform function". This can have between one and 254 arguments.

A before/after subroutine is intended to be invoked from job or active stage properties; it is never invoked directly from job control/job sequence.

You can, of course, CALL a before/after subroutine (with "DSU." prefix) from any other routine.

Posted: Fri Oct 13, 2006 11:12 am
by meena
Hi ArndW,
That's true that we can not use more than the parameters specified in the BEFORE/AFTER Routines.
My reply is a wrong answer to the above question.
Meena, you can specify optional arguments in user routines; but the number of parameters used in Before/After job routines as in the original post is fixed and you cannot change that.
Thank you,