Running multiple instances using dsjob

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
jtsoong
Participant
Posts: 29
Joined: Mon Oct 22, 2007 11:52 pm

Running multiple instances using dsjob

Post by jtsoong »

Hi Guys

I have written a daemon that polls a JMS queue and kicks off jobs using the 'dsjob' command.

It does this and detaches (i.e. it does not use the "-wait" nor the "-jobstatus" flags) - so the job will run in the background.

I now realize that there are going to be times when multiple jobs need to be run, when i try to start one job straight after another using 'dsjob' i get:

"Error running job

Status code = -2 DSJE_BADSTATE"

I have set up the job to be "Multiple Instance" in the Job Properties.

Am I doing something wrong, or is this not possible? :)

Thanks in advance.

Jon
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

Was the Invocation Id also same when executing that same Job without wait option in dsjob?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

More specifically, are you aware that you need to include an 'Invocation ID' when starting a multi-instance job to allow more than one instance to run at the same time? This can be pretty much any continuous alphanumeric value, as long as it is unique per run. And you specify it via dsjob by appending it to the MI job name with a dot. For example, in order to run an MI job called 'test', you might:

dsjob test.A
dsjob test.B
dsjob test.C


All three could run at the same time. Of course, there's more to it than that - the jobs must be designed to handle multiple invocations properly as well, but this should get you past this hurdle I assume.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jtsoong
Participant
Posts: 29
Joined: Mon Oct 22, 2007 11:52 pm

thanks!

Post by jtsoong »

ahh, thats excellent news. :)

i kind of discovered this problem just before i went home and worried about it for the whole bike trip home..

thanks very much for the solution, it'll make the bike ride to work tomorrow much more enjoyable.
Post Reply