Page 1 of 1

How to pass stage variable onto after-stage subroutine

Posted: Tue Dec 16, 2003 10:00 am
by Joshi.H
Hello,

I'm new to DataStage. I have a job, which compares to values in a Transformer and writes the result to a stage variable. I would like to pass this stage variable (meaning the value in it) onto a after-stage routine where a Call DSLogWarn is performed, if the value in the stage variable is not equal 0.

What do I have to put in the field "Input Value" where I select "After-Stage subroutine". The name of the stage variable is "Arg1".

Regards,

Joshi.

Re: How to pass stage variable onto after-stage subroutine

Posted: Tue Dec 16, 2003 10:04 am
by raju_chvr
One way can be is write the Stage variable to a file and you can use that file as an input in the next stage.

Re: How to pass stage variable onto after-stage subroutine

Posted: Tue Dec 16, 2003 10:07 am
by Joshi.H
Well, I simply would like to compare the number of rows which should have been transfered and the number of rows which have been transfered and if there is a difference I would like to write a Warning to the Log and make the Job stop. I do not want to use the variable in the next job, but the value of the variable in a routine where I would like to work with it.

Let me add something: I would like to pass the stage variable as an argument onto the routine.

Joshi.

Posted: Tue Dec 16, 2003 10:19 am
by kcbland
Put another output link to a hash file, sending the result of the stage variable everytime to the same row in the hash file. Use write-delay cache so there's no effort by the job. When the transformer finishes, the last row is written to hash file. The hash file contains one and only one row, your results. Draw a link out of the hash file to another transformer and then to a sequential text file. In that transformer do whatever you need to do, and output any error or exception reporting to the sequential text file.

There is no ability to communicate a stage variable to after transformer or job routines without a lot of work, using COMMONs and such, which may not be allowable in your job type.