dsjob - wait command

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
albasir
Participant
Posts: 18
Joined: Fri Nov 09, 2007 11:08 am

dsjob - wait command

Post by albasir »

Hi Everybody,

I have question.. can anybody help regarding my problem.

we have main script called first.ksh

first.ksh
[...
...
....
$DSHOME/bin/dsjob -run -wait -param inputFile=${STRIPPED_FILE} -jobstatus ogip sortNMR

ksh second.ksh output.txt
....
]

dsjob will create one file.. which will be used by second.ksh....

my question here is... if i dont use -wait option, second.ksh would be kicked off immediately after dsjob command... will it run sequencially or parallel?

-wait option would be applicable for another dsjob? will it give effect for subsequent script also?

Thanks in advance...
Basir
V'TH LUV
miwinter
Participant
Posts: 396
Joined: Thu Jun 22, 2006 7:00 am
Location: England, UK

Post by miwinter »

Yes, using wait will make it wait for the job to return it's status prior to continuing in your script, so these would run 'sequentially', as in end-to-end, meaning your job would run and then second.ksh would be called after that had ended in any state.
Mark Winter
<i>Nothing appeases a troubled mind more than <b>good</b> music</i>
albasir
Participant
Posts: 18
Joined: Fri Nov 09, 2007 11:08 am

Post by albasir »

Thanks for the reply....

I thought... dsjob -wait option would be applicable for another dsjob command not for script.

So its doesnt matter.. whether you are callling DSjob or script

Thanks for clearing my doubt...
V'TH LUV
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

But i think when you are using -wait OR -jobstatus option , it will wait till the completion of the job .That means if you are using only jobstatus option then it will wait till the completion of job and will return the jobstatus ...
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

albasir wrote:I thought... dsjob -wait option would be applicable for another dsjob command not for script.

So its doesnt matter.. whether you are callling DSjob or script

Thanks for clearing my doubt...
I still have doubt, mostly because I have no idea what you are saying here. The "-wait" option is only applicable to the invocation of "dsjob" that it is used with. It makes the dsjob command wait for the job to complete before moving on to the next step, whatever that is - the next line in a script or going back to the command line for a manual launch.

What do you mean by "would be applicable for another dsjob command not for script" above? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
albasir
Participant
Posts: 18
Joined: Fri Nov 09, 2007 11:08 am

Post by albasir »

Thanks for your reply....

i have script.... which follows

first.ksh
[
...
...
echo $DSHOME/bin/dsjob -run -param inputFile=${STRIPPED_FILE} -jobstatus ogip sortNMR > $SCRIPT/runCommandNMR
`chmod 770 $SCRIPT/runCommandNMR`
$SCRIPT/runCommandNMR

echo "Procesing the script now"
ksh $SCRIPT/splitNMR.ksh ${STRIPPED_FILE}meta ${STRIPPED_FILE}FAC #Start processing step.
echo "processing completed"
...
]

here first i am calling datastage job(without - wait option) and its give the output file.

and then am calling script(splitNMR) with output of previous step.


Log says:
---------
/opt/IBM/Ascential/DataStage/DSEngine/bin/dsjob -run -param inputFile=NMR_UI_US_ALL_ALL_WKY.20070224.0001U.00. -jobstatus ogip sortNMR
Waiting for job...
Finished waiting for job
Job Status : (3)

Status code = 3

Procesing the script now


My Analysis:
----------
Since i didn't give - wait option here... datastage job and script should have processed simultaneously/parallel... if you see here... script/echo command didnt execute after dsjob command.. its waiting to finish dsjob and then executing script/echo.

Wait option will be applicable only if we are calling two dsjob command one after another and want to execute sequentially. if we dont use - wait option in dsjob commands.. two jobs will start automatically.. This is my guess...

Can you please let me know my observation is correct or not?
V'TH LUV
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

No....As i have mentioned -jobstatus will wait till job completes and gives the status of the job .So , -wait option or -jobstatus will wait till job completes .
Nag
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, that "-jobstatus" is a "wait" option as well - both cause the job to wait to finish before returning, what changes is the status returned to the caller. As noted in the documentation.
-craig

"You can never have too many knives" -- Logan Nine Fingers
albasir
Participant
Posts: 18
Joined: Fri Nov 09, 2007 11:08 am

Post by albasir »

Thanks for the information...

Now I got it...

Actually.. i have included both "- wait" as well as "- jobstatus". but it was given broken pipe error. so i decided to remove "- wait" option.

I have got

Error 81002 waiting for job
Broken pipe..

without - wait or jobstatus.. will it overcome the issue? or do we need to increast time out parameter.. i was searching for forum.. and my criteria didnt meet what am looking for...

Any help would be much appreciated...

-Basir
V'TH LUV
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use -wait OR -jobstatus option, not both.

Without either of these control returns to first.ksh immediately the job starts.
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