Job status within a sequence

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
swathi.raoetr
Participant
Posts: 22
Joined: Tue May 09, 2017 8:46 am

Job status within a sequence

Post by swathi.raoetr »

Is there a way we can call the job status of the previous job, in a later job at the sequence.

Job 1---> Job2 -- Sequencer---> Job3

I would like Job1.status to be given as a parameter in Job 3.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

you can get this with an orchadmin command or a routine.
I don't know the syntax cold but if you need help I can figure it out. Its 'something like'
getjobstatus (actual job name, invocationid)

but the actual name and parameters I would have to get from the help documents.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't recall having to do anything special for this. Any information from previously executed stages should be available to the current one. Is it not listed if you open up the "parameter helper" widget (the ... ellipsis) inside the Job3 parameter you want to set?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

While the metadata is available through calls to DSGetJobStatus(), the Status of any predecessor of "Job3" might not have been updated at the Point in time when it is called - These are not always synchronous calls. You might write a Loop that waits until the Job is no longer running accoording to DSGetJobInfo() before returning the final Status.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Errr? The JobActivity stage won't trigger the next stage in the sequence until the job completes. What am I missing here? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I recall having done exactly this call of DSGetJobInfo() in a project in the past and gotten an invalid status back; the assumption at the time was that the status wasn't committed. But I just recalled that you can use the Status of a predecessor directly within the sequence with no issues, if the Job is called "Job1" in sequence, then the activity variable "Job1.$JobStatus" will contain the correct Status upon completion.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

... as noted. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
swathi.raoetr
Participant
Posts: 22
Joined: Tue May 09, 2017 8:46 am

Post by swathi.raoetr »

Thanks UCDI, yes this is what I was looking for. So if we go for a routine we would need to build a custom one or is there an existing routine?
swathi.raoetr
Participant
Posts: 22
Joined: Tue May 09, 2017 8:46 am

Post by swathi.raoetr »

Yes chulett it would work, as the Job1 would be completed and only on error the Job 3 would be called.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, in other words you don't need anything special or custom or routine-based, you just need to leverage the existing functionality.
-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 »

BTW, if in an after-job subroutine, you can request the job's interim status - that is, the status that it will have provided that the after-job subroutine completes without setting the ErrorFlag return value to non-zero.
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