To check status of the job using Shell Script
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 11
- Joined: Thu Sep 13, 2007 12:56 am
To check status of the job using Shell Script
Hi All,
I want to check the status of the job (whether it is executed or not) through a UNIX shell script. Is there any way in DS where I can fetch only the status of the job?
Thank you.
I want to check the status of the job (whether it is executed or not) through a UNIX shell script. Is there any way in DS where I can fetch only the status of the job?
Thank you.
-
- Participant
- Posts: 334
- Joined: Fri Dec 01, 2006 5:17 am
- Location: Texas
Yes! :D
You can use following 'dsjob' command to achieve the same:
In that you can check your job status, it in 'Job status'.
You can use following 'dsjob' command to achieve the same:
Code: Select all
. $DSHOME/dsenv
$DSHOME/bin/dsjob -report $project_name $jobname BASIC
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
-
- Participant
- Posts: 334
- Joined: Fri Dec 01, 2006 5:17 am
- Location: Texas
I have develop a simple script where in you will get Start Time,End Time,Time consumed,Rundate and Status.You can modify the script as per your requirement.Below is script.
It will take 2 parameters
1.Project Name
2. Job Name
Hope this will help you !
It will take 2 parameters
1.Project Name
2. Job Name
Code: Select all
#!/bin/ksh
. $DSHOME/dsenv
TempDir=Path of Directory
proj=$1
jobname=$2
. $DSHOME/dsenv
$DSHOME/bin/dsjob -report $proj $jobname BASIC 2>/dev/null > $TempDir/tmp.txt
StartTime=`more $TempDir/tmp.txt| fgrep "Job start time" |cut -f2 -d'='` #Getting Start time
EndTime=`more $TempDir/tmp.txt| fgrep "Job end time" |cut -f2 -d'='` #Getting End time
TimeConsumed=`more $TempDir/tmp.txt| fgrep "Job elapsed time" |cut -f2 -d'='` #Getting Time Consumed
Status=`more $TempDir/tmp.txt| fgrep "Job status" |cut -f2 -d'='|cut -f2 -d'('|cut -f1 -d')'` #Status of job
rundate=`more $TempDir/tmp.txt| fgrep "Generated"|cut -f2 -d':'|cut -f2 -d' '`
echo "Job Detials are :"
echo "StartTime=$StartTime"
echo "EndTime=$EndTime"
echo "TimeConsumed=$TimeConsumed"
echo "Status=$Status"
echo "rundate=$rundate"
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
-
- Participant
- Posts: 11
- Joined: Thu Sep 13, 2007 12:56 am
First, we may recommend you to have a look at Server Job Developer's Guide v7.5 page# 711.
You can better use dsjob -jobinfo for retrieving current Job Status information of a Job.
You can better use dsjob -jobinfo for retrieving current Job Status information of a Job.
Code: Select all
Job Status:
1. RUNNING
2. RUN OK
3. RUN with WARNINGS
4. RUN FAILED
5. VALIDATED OK
6. VALIDATE with WARNINGS
7. VALIDATION FAILED
8. RESET
9. STOPPED
10.NOT COMPILED
11.NOT RUNNING
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
These are NOT the correct job status codes. The correct job status codes are to be found in the JOBCONTROL.H header file in the DSINCLUDE directory (or by searching DSXchange).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod,
I did not list the Job Status Code, indeed but just listed out Job Status in words.
For your information:
Author(girish.rupkumar)
If you feel that the suggested two solutions can definitely resolve your problem, you can certainly go on helping future searchers by keeping your thread under resolved.
I did not list the Job Status Code, indeed but just listed out Job Status in words.
For your information:
Code: Select all
Job Status Code taken from JOBCONTROL.H
* Possible return values for token DSJ.STATUS:
Equ DSJS.RUNNING To 0 ;* This is the only status that means the job is actually running
Equ DSJS.RUNOK To 1 ;* Job finished a normal run with no warnings
Equ DSJS.RUNWARN To 2 ;* Job finished a normal run with warnings
Equ DSJS.RUNFAILED To 3 ;* Job finished a normal run with a fatal error
Equ DSJS.VALOK To 11 ;* Job finished a validation run with no warnings
Equ DSJS.VALWARN To 12 ;* Job finished a validation run with warnings
Equ DSJS.VALFAILED To 13 ;* Job failed a validation run
Equ DSJS.RESET To 21 ;* Job finished a reset run
Equ DSJS.CRASHED To 96 ;* Job has crashed
Equ DSJS.STOPPED To 97 ;* Job was stopped by operator intervention (can't tell run type)
Equ DSJS.NOTRUNNABLE To 98 ;* Job has not been compiled
Equ DSJS.NOTRUNNING To 99 ;* Any other status
If you feel that the suggested two solutions can definitely resolve your problem, you can certainly go on helping future searchers by keeping your thread under resolved.
Last edited by ag_ram on Thu May 29, 2008 10:00 pm, edited 1 time in total.
But the fact that you numbered them was... misleading.ag_ram wrote:I did not list the Job Status Code, indeed but just listed out Job Status in words.
ps. I'm a little confused by both locations mentioned where you can find this information on your own. There's no DSINCLUDE directory on my server, nor a DS_JOBOBJECTS.H or JOBCONTROL.H that I can find. Where I've always looked for all information of this nature is in:
$DSHOME/include/dsapi.h
Ahhh... found them. They are in the 'dsinclude' (lower case) subdirectory in each Project. DS_JOBOBJECTS.H is actually DSR_JOBOBJECTS.H but does not include this information. JOBCONTROL.H is more akin to what is in the Engine's dsapi header file.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DSINCLUDE is upper case in the VOC file, and therefore you use the upper case variant in a $INCLUDE declaration.
As to DS_JOBOBJECTS.H, that is something that ag_ram incorporated; it does not exist (as Craig noted).
As to DS_JOBOBJECTS.H, that is something that ag_ram incorporated; it does not exist (as Craig noted).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.