scope of USERSTATUS

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

scope of USERSTATUS

Post by zulfi123786 »

I have a situation where there are multiple jobs placed in sequences and these sequeces are further held in parent sequences. I need to have a meathod of holding a paricular value (conversion factor) and this value is calculated in multiple jobs and the most recent value calculated need to be available in another set of jobs which use the conversion factor.

I was thinking of using USERSTATUS but before that would be grateful if any one could please let me know what is the scope of this variable - just the sequence encapsulating the job that writes to USERSTATUS or ever to the uppermost parent sequence and any job run either directly or indirectly by the uppermost parent sequence ?

I guess USERSTATUS lies somewhere in the RT_**** hashed files but what is the entity that owns this RT_**** hashed file that holds this variable.


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

Post by ray.wurlod »

You are correct. The job's user status area is a field within the job's RT_STATUSxxx hashed file. Therefore it is destructively overwritten, so that only the most recently-written value is available at any time.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

Since the topic has come out, I would like to get my understanding confirmed regarding USERSTATUS - RT_STATUSnnn

Each job/Sequence (not sure about server routines) have an RT_STATUSnnn hashed file to capture the USERSTATUS. when any job writes to USERSTATUS held by its RT_STATUSnnn the job also gets its Controller Job information and updates the same into its RT_STATUSnnn and recursively upto the parentmost sequence and when any job tries to fetch USERSTATUS then it reads from the RT_STATUSnnn of the parentmost sequence.

This is how I envison most updated USERSTATUS to be available in each job of a sequence. Please let me know if any or the whole of my understanding is incorrect.
- Zulfi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The whole of your understanding is incorrect.

Each job (each instance of a multi-instance job) has various entries in its own RT_STATUSxxx hashed file, and only its own user status is recorded in one particular record in that hashed file.

Sequences are jobs, so they have their own, independent RT_STATUSxxx hashed file and therefore independent mechanism for storing their own user status.

No hierarchy of user statuses is supported.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

ray.wurlod wrote:No hierarchy of user statuses is supported.
If I have a parent job sequence having two sequences each internally have job activity stages like a B-Tree of order 2 then is there any other way of passing a value from a job activity on the leaf node of one sequence to a job on the leaf node of another sequence (as hirarchy is not suppored for USERSTATUS) apart from holding it in a sequential file ?
- Zulfi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The USERSTATUS of any job can be fetched at any time but is typically done after the job has completed. It is preserved until the next time the job is run or it is reset / recompiled. Typically some mechanism (say, via the API) would be used to fetch it from one job and pass it as a job parameter to another job. Your higher level sequence could certainly do this for any two jobs it controls if you know one will finish before the other starts. The sequence automates the capture of this.

You could also easily write a routine (or use a User Variable stage I suppose) to fetch the USERSTATUS value from a job not under control of the sequence itself to pass to one it does control.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Any sequence activity can retrieve the job status of a Job activity that is upstream of the requesting activity through use of the activity variable $UserStatus.

If the Job activity is not upstream in the sequence this is not directly accessible, but the user status could be retrieved via a routine or via a dsjob command in and Execute Command activity. If you really know what you're doing, you could also use a Trans() function in an User Variables activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

Thanks for the information Ray.

Since in my situation I have multiple jobs calculating the same variable and the most recent calculated value has to be used across various jobs some of them dont happen to be the successors of the jobs calculating them and I never know which job has executed just before the run of a specific job, I guess there is no straight forward easy way for using USERSTATUS.

Guess a better option is to copy the code of SDK routines for SK keys and modify to hold a decimal and overwrite each time rather than increment.

Would be grateful if any better idea is adviced.
- Zulfi
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

Has anyone seen an API for accessing Universe table via C++ code of a parallel routine. Have searched some posts but did not find any luck at the time of those posts.
- Zulfi
Post Reply