Forcing the JobStatus in a Routine

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
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Forcing the JobStatus in a Routine

Post by davidnemirovsky »

I am trying to set a special JobStatus for jobs which reject rows based on certain business rules. The job is invoked using dsjob run from a third party scheduler and support needs to know when this situation occurs.

I am using a Transform Routine invoked in a derivation of a Reject link.

If we get any rejects then I need to set the JobStatus to something other than 0 or 1 or 2 (ie. 3 or 4 or 5...).

At the moment my Routine looks like this:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
Equate RoutineName To "SetRejectionStatus"
Call DSSetUserStatus("2")
MyStatus = DSGetJobInfo(DSJ.ME, DSJ.JOBSTATUS)
Call DSLogInfo("MyStatus=" : MyStatus, RoutineName)
Ans = "Rejects"
MyStatus=0 is what I get from the DSLogInfo statement.

How do I accomplish this?
Cheers,
Dave Nemirovsky
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

David,

I'm away from a DS installation (and documentation), but I think there is another code in the DSGetJobInfo() call for the User status vs. the job status.
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

Arnd,

I believe that would be 'DSJ.USERSTATUS' but that's not what I'm after.

I want to force the JOB status not the UserStatus so that the third party controlling tool gets a different return code from the unix script that runs dsjob.

Does that make more sense?
Cheers,
Dave Nemirovsky
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

After a bit of lateral thinking...

How would I output the UserStatus of a job in a unix script?
Cheers,
Dave Nemirovsky
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Isn't there a -userstatus option for the dsjob command? :?
-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 »

You don't get any mechanism for altering the job status apart from DSLogWarn and DSLogFatal, and setting the ErrorCode argument of a before/after subroutine to a value of other than 0. All of these except DSLogWarn cause the status to be 3; DSLogWarn causes the status to be 2 unless the job aborts for some other reason.

That's why user status is there. It's yours. Job status isn't: it's theirs.

The only other choice you might have is DSStopJob(DSJ.ME), which will change the status to DSJS.STOPPED - not, I suspect, your desired outcome.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

But - as noted - you can launch the job with the -userstatus option and then it (if set) will be returned as the exit status when the job completes. :wink:

Seems to be exactly what David is after.
-craig

"You can never have too many knives" -- Logan Nine Fingers
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
AFAIK,
Using dsjob will result in more info then just the user status.
Download Ken's kshell script from ADN and apply your changes if needed.
Basicly it outputs the stdout & stderr to a file and sample the file to gain whatever data you need.
I implemented such a script to function as a ^M DS jobs launcher utility.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
davidnemirovsky
Participant
Posts: 85
Joined: Fri Jun 04, 2004 2:30 am
Location: Melbourne, Australia
Contact:

Post by davidnemirovsky »

I suppose I should have taken a step back and not gone into solutions mode :oops:

So now I'm running a sequence using DSJOB but I've changed a UserStatus of a job within that sequence. If I use the -userstatus option I pressume I'll get the UserStatus of the sequence and not the job? Is this correct? If so, I should use something like a DSJOBINFO from the unix script? Is there such a command? I've been looking through the doco but can't remember where it's located!

Thanks for everyone's input. Nothing like being a little rusty and then getting thrown in the deep end!
Cheers,
Dave Nemirovsky
Post Reply