Command for reseting jobs if required and the execute

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
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

Command for reseting jobs if required and the execute

Post by soportesis »

Hello,

Is there a command option with the "dsjob" used reseting jobs if required and the execute??

Thanks in advance,
Frankie 22''
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, this is only available in sequences.

However you could script dsjob -jobinfo to determine the job's status then dsjob -run -mode RESET if necessary then dsjob -run -mode NORMAL to actually run the job. (Option -mode NORMAL can be omitted.)
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 »

Exactly. In other words you have to replicate the steps that the Job Activity stage does for you automatically... thankfully, it's a pretty straight-forward and simple task.
-craig

"You can never have too many knives" -- Logan Nine Fingers
soportesis
Premium Member
Premium Member
Posts: 21
Joined: Thu May 31, 2007 8:58 am

Post by soportesis »

OK, Tnks a lot
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Here is a code snippet.

Code: Select all

# -----------------------------------------------------------------
# Check current job status here 
# -----------------------------------------------------------------
DsJobStatus=`$DSPath/dsjob -jobinfo $ProjectName $JobName | head -1 | cut -d"(" -f2 | cut -d")" -f1` 
case $DsJobStatus in 
# -----------------------------------------------------------------
# 0 "Running" 
# -----------------------------------------------------------------
    0) 
        print " ERROR: Job $JobName already running." 
        exit 1
        ;; 
# -----------------------------------------------------------------
# Runnable Job Status (do nothing) 
#  1 "Finished" 
#  2 "Finished (see log)" 
#  9 "Has been reset" 
# 11 "Validated OK" 
# 12 "Validated (see log)" 
# 21 "Has been reset" 
# 99 "Compiled" 
# -----------------------------------------------------------------
    1|2|7|9|11|12|21|99) 
        : 
        ;; 
# -----------------------------------------------------------------
# NOT Runnable Job Status (reset job) 
#  0 "Running" 
#  3 "Aborted" 
#  8 "Failed validation" 
# 13 "Failed validation" 
# 96 "Aborted" 
# 97 "Stopped" 
# 98 "Not Compiled" 
# -----------------------------------------------------------------
   *) 
        $DSPath/dsjob -run -mode RESET -wait -jobstatus $ProjectName $JobName
        ReturnCode=$?
        if  (( $ReturnCode==21 ))
        then
            :
        else
            print
            print " ERROR: Unable to reset job $ProjectName $JobName"
            exit 3
        fi
esac 
Mamu Kim
Post Reply