Page 1 of 1

capture -jobinfo result in windows batch

Posted: Tue Apr 15, 2008 9:51 am
by Juls
Hi,
I created a batch file in windows that runs a DS job. I want to check the status of the job and then decide whether a reset is needed. I am having trouble capturing and reusing the result of the status in a variable. Here is my code:

REM GET status info
%DSJOBPATH%\dsjob -jobinfo %PROJECT% %DSJOB%

how do I capture and reuse the result of above in an if statement.
This line DOES NOT WORK:
JOB_STATUS=%DSJOBPATH%\dsjob -jobinfo %PROJECT% %DSJOB%

Thanks,
Juls.

Posted: Tue Apr 15, 2008 10:22 am
by chulett
Redirect the output to a file, then check the file.

Posted: Tue Apr 15, 2008 10:32 am
by Juls
chulett wrote:Redirect the output to a file, then check the file. ...
Thanks, do you, by chance, have a sample how to check the file, how do I parse it?
Here is what the file has:
Job Status : RUN OK (1)

Job Controller : not available

Job Start Time : Tue Apr 15 11:24:43 2008
Job Wave Number : 7

User Status : not available

Job Control : 0

Interim Status : NOT RUNNING (99)

Invocation ID : not available

Last Run Time : Tue Apr 15 11:25:08 2008
Job Process ID : 0

Invocation List : seq_STAGING

Posted: Tue Apr 15, 2008 12:35 pm
by chulett
For UNIX, sure. Under Windows? Nope, sorry, my DOS days are well and truly behind me.

Posted: Tue Apr 15, 2008 1:36 pm
by chulett
What exact information are you looking for? Just to know if the job is aborted? I use grep for that in a shell script, something like this:

Code: Select all

eCount=`grep '(3)' /tmp/dsjob$$.out |wc -l`
if [ $eCount -eq 1 ] ;then
  echo "Job is aborted and must be reset..."
  <run reset>
I just have no clue how to do this in a batch without the MKS Toolkit, if you have that available you can do shell scripting rather than a batch file, from what I understand.