Run a job without waiting to complete

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
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Run a job without waiting to complete

Post by PeterPol »

Hi all,

We have build a sequence with a loop that must be run a job every hour. Each running job has it's own unique invocation id to make it possible that the same job can run twise (or more ) at the same time.

Each hour the job will be started even if the previous job is still running.

After starting the loop in the seqeunce, the job will be runnning. Now we don't want to wait untill the job is finished otherwise the job can not start the next hour because the seqeunce is still be waiting to finish the previous job run.

So the qeustion is: How can we run a job without waiting to be finished.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Call the job using dsjob command without -wait option.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's the answer if the Sequence job itself is what must be started without waiting - and the Sequence is multi-instance. It was hard to tell from your post, but are you asking how to do this for a job that the Sequence itself runs? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Post by PeterPol »

No, the job in the seqeunce must be started witout waiting..

How can you start a Comand Line interface commando dsjob in a seqeunce?

I just wan to run the job without waiting to finish.....
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not sure why you can't work around the issue of waiting for the job to finish in the sequence, but yes, you can call a command stage and issue the appropriate "dsjob -run" command from a sequence.
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Post by PeterPol »

This job seqeunce is the first job in my process to run all other processes after each hour. But when a process is still busy. The first job seqeunce must start all other processes with a new invocation id.

The problem is if a job is started in the seqeunce the job seqeunce will wait until the job has finshed and wait than an hour.

:roll:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In that case you should write a "master" sequence which calls the first job/sequence without waiting. I see two ways to do this for you:

1 - use the command to run "dsjob -run -mode normal {job} {project}"

2 - use a job activity to start the job in a sequence. Then look at the job control for the BASIC code that has been generated and you can see where to remove the WAIT. Note that changes disappear when you recompile, so this is not the recommend route.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can use an Execute Command activity to execute dsjob, as others have noted.

You can also use a Routine activity to call UtilityRunJob, or a routine of your own that submits the run request and exits without waiting for the job to finish.

Code: Select all

FUNCTION RunJobNoWait(JobName, InvocationID)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

hJob = DSAttachJob(JobName : "." : InvocationID, DSJ.ERRNONE)

Ans = DSGetJobInfo(hJob, DSJ.JOBNAME)
If Ans >= DSJE.NOERROR
Then 
   Ans = DSRunJob(hJob, DSJ.RUNNORMAL)
End

ErrCode = DSDetachJob(hJob)

RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PeterPol
Premium Member
Premium Member
Posts: 73
Joined: Wed Mar 08, 2006 8:59 am

Post by PeterPol »

Thanks
The writen routine works for my problem. :D
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Time to mark your post as 'Resolved'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply