Unix shell script to call datastage job error

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
qutesanju
Participant
Posts: 373
Joined: Tue Aug 26, 2008 4:52 am

Unix shell script to call datastage job error

Post by qutesanju »

I'm trying to use Unix shell script to call datastage job

Background:
I have a sequence job that contains a Sequential File,Transformer ,ODBC stage,lookup stage .It simply loads data from txt file to a table.

Here datastage job loads multiple input files using loop in unix scripts
i.e it takes first file ,processes it and then picks second file.
but prob here is lets say while processing first file if it has rejects,job finishes with warning ,and unix scripts returns different error code.and because of this error code returned,it dosent picks second file ,so where should I make changes?in order unix script should handle error code and should pick up next file

in unix script to handle error code?
If yes what are error code that needs to be placed in unix script
Or change in data stage job Sequencer job to set status to success even if it has warnings?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Which dsjob option are you using in your script: -wait or -jobstatus? You should be using the latter if you want to differentiate between the status values a job can end in.
-craig

"You can never have too many knives" -- Logan Nine Fingers
qutesanju
Participant
Posts: 373
Joined: Tue Aug 26, 2008 4:52 am

Post by qutesanju »

at present I jave code wirtten as

Code: Select all

if [ $stat -ne 0] 
then
errmsg="Error while running Datastage process"
ksh $erremailshell $feedname $jobname "${errmsg}"
exit 1
And I'm thinking to change it as

Code: Select all

 if [ $stat = 1] OR [ $stat = 2]
      then
      errmsg="Job completed successfully"
qutesanju
Participant
Posts: 373
Joined: Tue Aug 26, 2008 4:52 am

Post by qutesanju »

Or is there a way to change the Datastage job to handle the warning?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You didn't answer my question but if you use -jobstatus then you are on the right track as 1 = Finished OK, 2 = Finished with Warnings, 3 = Aborted, etc.
-craig

"You can never have too many knives" -- Logan Nine Fingers
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Post by zulfi123786 »

The most important part

how is

Code: Select all

 $stat
set
- Zulfi
Post Reply