Returning stage variable value to Control job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
120267
Participant
Posts: 30
Joined: Tue Jun 07, 2005 12:27 am

Returning stage variable value to Control job

Post by 120267 »

Hi,
How to return the value of stage variable to a control job.

i.e. I am Storing the count of Duplicates in a stage variable.I want to return this count to the Control job.so that i will log this count in error table.

Thanks,
SivaG
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You have to output it to a hash file or a sequential file. You could write it to the log every time it changes.
Mamu Kim
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello 120267,

to expand on what Kim has already stated, the communication between a sequence (or controlling job) and a child is via job parameters. These parameters cannot be changed by the child, so the exchange of data only works in one direction - from parent to child.

Your controlling process must therefore get the information. As Kim pointed out, the child needs to store this information somewhere (a sequential or hashed file or by writing it into the log file) and then the calling process needs to retrieve this information - probably the easiest solution is to write your own small routine and call this through a routine activity in the sequencer.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

One value can be loaded into the job's User Status area. This value can contain anything, including a delimited string, by which means it can pass more than one actual value.

A job sequence can access the job's user status area conveniently through the job activity's activity variable $UserStatus.

Of course, only the final value will be recovered in the control job; even though a stage variable might be updated every row, control does not return to the controller until the current run finishes.

Perhaps you have not thought through your requirement sufficiently thoroughly?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
120267
Participant
Posts: 30
Joined: Tue Jun 07, 2005 12:27 am

Post by 120267 »

Hi ray,

Thanks,Will u guide me how to Store the Stage variable value in to $UserStatus.

And how to retrive the value from $UserStatus in control job.

Thanks,
SivaG
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you search for the answer? You would have found this routine.

Code: Select all

FUNCTION SetUserStatus(TheValue)
Call DSSetUserStatus(TheValue)
Ans = TheValue
RETURN(Ans)
Invoke this in any column derivation that's not doing anything else, with the stage variable name as its argument. Or modify the code so that the DSSetUserStatus routine is invoked from an after-stage or after-job subroutine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply