Page 1 of 1

Returning stage variable value to Control job

Posted: Sat Oct 15, 2005 4:51 am
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

Posted: Sat Oct 15, 2005 5:05 am
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.

Posted: Sat Oct 15, 2005 5:45 am
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.

Posted: Sat Oct 15, 2005 6:33 pm
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?

Posted: Sun Oct 16, 2005 5:34 am
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

Posted: Sun Oct 16, 2005 4:25 pm
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.