Design a job with infinite loop

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
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Design a job with infinite loop

Post by prasson_ibm »

Hi,

I have a requirement where i have to design a sequence job which will keep on running and it will look for trigger file.

Trigger file will be created by another master job,which has source as MQ. This job will also keep on running and as soon as message land up to the MQ it will create trigger file.Design will be look like this:-

Code: Select all

Master Seq  (infinte loop)---> SubSeq1                         ------> seq
                             (infinte loop wait for trigger)
                        ----> SubSeq2                         --------> seq
                        ----> SubSeq3.......100             ---------> seq 


It will have more then 100 distinct sequences which will be always running and waiting for trigger file.Once trigger file created that particular sub sequence should start.My worry is may these infinite running jobs will eat more CPU resources and phantom process.Is it a good approach to design a flow like this.Need experts advice.
chetan.c
Participant
Posts: 112
Joined: Tue Jan 17, 2012 2:09 am
Location: Bangalore

Post by chetan.c »

Not an expert , but this is how we had done it.
Since the OS is mentioned as UNIX.
A while loop with a condition for controlling the start and stop of the loop.

In the while loop , check for the existence of the trigger file ,if present run the job using the dsjob command else some wait time to recheck for existence of the trigger file.
Once the job is completed , the while loop will continue to check the existence of the file.

Thanks,
Chetan.C
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi Chetan,
Thanks for your input,but we cant use unix script here to create a loop,this we are doing in job sequence.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need a clean mechaism for shutting down the sequence. Therefore you should set a timeout on the WaitForFile activity. If this triggers (Failure trigger = timeout) take a branch to check for the existence of another file that indicates that the sequence should shut down and, if found, invoke a Terminator activity.

The other problem is how to set up an infinite loop in a sequence. A counted loop that has a very large limit should be close enough for your needs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There is no such thing as an "infinite loop" in a Sequence job, nor is it a good idea to run one 24x7. At the very least have it stop once a day and then schedule it to restart shortly thereafter.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I implemented such a job sequence a while back and seem to recall having had problems at either 32K or 64K iterations. Best to let it stop and restart before it reaches that number of iterations.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi Everyone,

Thanks for your input.My client is very rigid and they dont want to change their flow so we cant directly schedule our jobs in appworks.
We have only this option to look for trigger file which is given to DS as MQ message and then need to trigger out sub sequence.For loop we have given from 1 to 99999. I hope it will cover many iteration.

Thanks
Prasoon
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok... 1 to 99999, then what happens? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you need more, put in another 999999 outer loop, giving you a total of 9999800001 iterations.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's crazy talk, as noted I would never design anything of the sort. However... maybe that's just me. :P
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If he'd written that the platform was Windows I wouldn't have worried about reaching either number as a system reboot would almost certainly occur before that was reached. UNIX has a better chance, but might run out of memory before doing so :)
Post Reply