Run Multiple instance with max of 2 instances.

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
velayuthan
Participant
Posts: 10
Joined: Fri Jul 13, 2007 4:01 am

Run Multiple instance with max of 2 instances.

Post by velayuthan »

Can someone guide me, "how to approach" on the following scenario in shell scripting.

Audit Table
-------------
ID Date Status
A 16-Apr Data Ready
B 15-Apr Data Ready
C 15-Apr Data Ready
D 16-Apr Data Not Ready
E 16-Apr Data Ready

I Have the above audit table which is updated every 1 hour.

Need to update the status as "In Progress " and run a datastage sequencer with ID (A and B ) and Date i.e using multiple instance.

If the above sequencer is completed for either A or B then the Status should be updated to "Completed" in Audit Table

and then the sequencer should be automatically trigerred for C and the Status should be updated to " In Progress" in Audit Table

i.e at any time the sequencer should run for max 2 ID's .

and so on.......

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

Post by ArndW »

The "Job Activity" in job sequences has an automatic wait-for-job-to-end attached to it, so you would start your jobs by executing the appropriate command line dsjob. You could put a before-job call in the instance jobs that update the table with status of "In Progress" and an after-job call to update to "Completed".
You will need to find a mechanism to query your audit table from the job sequence (executing a command-line SQL would do the trick) and then for all jobs with a status of "In Progress" determine if they are actually still running or might have aborted and then decide how many jobs with status of "Data Ready" you can start.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

What happens if one of your sequence fails ? Should the system stop or proceed for other rows ?

One option will be to have 2 instances - one for odd and one of even IDs. This way, you keep the flow simple and separate.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why "in shell scripting"? That seems like a needless complication to me, I would do something like this in a Sequence or more likely hand coded "job control" code.
-craig

"You can never have too many knives" -- Logan Nine Fingers
velayuthan
Participant
Posts: 10
Joined: Fri Jul 13, 2007 4:01 am

Post by velayuthan »

In case if the Audit Table has more record and if we need to run a maximum of 4 instances .how ca we achieve through loop ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a Nested Condition activity to determine how many instances are already running. On second thought, a Routine activity may be easier for accomplishing this task.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
velayuthan
Participant
Posts: 10
Joined: Fri Jul 13, 2007 4:01 am

Post by velayuthan »

Hi
can any one help me to run this 4 instances parallely at a time through scripts
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I just did! Only run another instance when there are eligible candidates to run and there are fewer than four jobs already running.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

velayuthan wrote:Hi
can any one help me to run this 4 instances parallely at a time through scripts
Is there a reason you are stressing on scripts? As suggested by many here, you can achieve what you described in your first post without using scripts (as in shell scripts...)
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
Post Reply