Job handling in Unix

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Job handling in Unix

Post by arsheshadri »

Hi,

I have been working on datastage from past few months.
All these days I was using DS Designer, Director, Manager for Designing / Running jobs.
Now I have to manage the jobs in unix by writing some shell scripts.

I have following basic questions, request you to clarify.

1. How can we check the job run status from Unix?
Any particular parameter that we can check using Shell program?

2. Does datastage write job execution logs in any physical files.
If yes then how can we see / change the log's destination?

3.I am trying to run a job in unix, If I try to run a job without compiling it then I am getting following error
"Error running job" "Status code = -2 DSJE_BADSTATE"
If I compile it from designer and run the job, It is running without any errors. Can any one tell me how we can resolve this?

Any other inputs on Managing DSJobs on Unix will be of great help.

Thanks
Sheshadri
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Heres my 2 cents:

1. How can we check the job run status from Unix?
Any particular parameter that we can check using Shell program?


You could either do a dsjob -report
Print that to a file
Grep for the status and cut the code value
OR
you could just run your job via the dsjob -run command
and for status put a command like
RETURN_VALUE=$?
to get the status of your previous command and then print that to a file


2. Does datastage write job execution logs in any physical files.
If yes then how can we see / change the log's destination?

You could save the logs in a physical place by running the log commands
with the dsjob command
like logsum, report, log etc and save it to a file

3.I am trying to run a job in unix, If I try to run a job without compiling it then I am getting following error
"Error running job" "Status code = -2 DSJE_BADSTATE"
If I compile it from designer and run the job, It is running without any errors. Can any one tell me how we can resolve this?

You can also reset the job from your unix script, again by the dsjob.
dsjob -run -mode RESET -wait ProjectName JobName


Hope it helps
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

Thanks a lot. The reply solved most of the issues :)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DSguru2B wrote:you could just run your job via the dsjob -run command
and for status put a command like
RETURN_VALUE=$?
to get the status of your previous command and then print that to a file
You should also look into the use of the -jobstatus option rather than the -wait option. Rather than return the 'standard' zero or non-zero status code, what you will get back are the same return codes as are logged in the Director:

1 = Finished Ok
2 = Finished with warnings
3 = Aborted

etc. I've found that more useful in my experience.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I most definately agree Craig.
Arsheshadri:
You can use Craigs advice or somthing like

Code: Select all

dsjob -jobinfo Project JobName | head -1 | cut -c33
to get the job status.
Regards,
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

Hi,

Can some one copy Craig's msg and send it :) I am not able to read it :(

"dsjob -jobinfo Test MiscTest|head -1|cut -c33" command works only if job status "Job Status : RUN with WARNINGS (2)". for other status we have to change "cut -cxx" cmd.

I wanted to check the status dynamically from a script and implement something like this

If status - 1 then echo "Job Run"
If status - 3 then echo "Job aborted"
If status - -1002 then echo "Failed to open a proj"
If status - -1004 then echo "Failed to open a job"...etc

Thanks for all your inputs
Sheshadri
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

My post is simple enough, just a mechanism to get the job status back directly in the return status without having to 'grep' or 'cut' anything out of the text that is returned as well.

I unmarked it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Post by arsheshadri »

[quote="chulett"]My post is simple enough, just a mechanism to get the job status back directly in the return status without having to 'grep' or 'cut' anything out of the text that is returned as well.

I unmarked it.[/quote]

Thanks Craig, I am using jobstatus now. we don't have to use wait cmd and we get back the status also :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Job handling in Unix

Post by ray.wurlod »

arsheshadri wrote:Now I have to manage the jobs in unix by writing some shell scripts.
Why? Your three questions indicate that you lack fundamental understanding of how DataStage works and/or that you have not read the documentation for dsjob in the manual. May I suggest you find and attend a training class?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
arsheshadri
Participant
Posts: 78
Joined: Wed Oct 26, 2005 6:12 am

Re: Job handling in Unix

Post by arsheshadri »

[quote="ray.wurlod"]May I suggest you find and attend a training class?[/quote]

Do you think one can get better exposure to datastage by attending training classes? :o

I have attended a corporate training class conducted by IBM on
"IBM Websphere datastage Introduction to Enterprise Edition"

believe me, I have learnt lot more by using this forum than by attending the classes and my company won't afford another training class on same.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Clearly you did not attend one of the training classes that I ran! If you had a bad experience, do let IBM know. They seem to be quite genuine in wanting to improve the training classes.
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