Page 1 of 1

Running a job in a loop

Posted: Tue Nov 15, 2005 8:02 am
by PhilHibbs
One of my colleagues has a requirement to process a single row from a file at a time, passing the result to a second DataStage job, and then processing the next row.

My suggestion is to have a Transformer that outputs @INROW=1 to the processing code, and @INROW>1 to another sequential file, running the job from a shell script that then renames the output file to be the input file name and runs the jobs again.

Does this sound like a reasonable approach? I saw allusions to some kind of looping mechanism in Job Sequence when I looked through the archive, but can't find any looping capability in the documentation. Now that I look again, it's referring to DS 7.5 which we don't have.

Posted: Tue Nov 15, 2005 8:15 am
by chulett
Yes, there are Looping stages that were introduced in the 7.5 Sequencer which as you noted won't help you with this.

For you, hand-coded job control could handle that requirement. If you want to do this in a job, search the forum for usage of the 'UtilityRunJob' sdk routine, it will allow you fulfill your original requirement.

Posted: Tue Nov 15, 2005 8:27 am
by roy
Hi,
First thing that comes to my mind when you want to proces 1 row at a time is a real time environment where a web service DS job made with SOA webservices tool might be handy (but this might not be you'r case).

As for implementing this in DS server you simply get a parameter and use to supply the row or a file with it and run a job that handles it.

You'll need to wrap this with some basic job control code or with an external program utilizing the API or ussage of dsjob command line utility foreach job run (API will need and C/C++ programing calling dsjob is more simple primitive but may not be performance wise satisfactory).

In any case how may rows do you expect?
Is there any way of turning this to a batch process processing more then 1 row a time and perhaps building a control file you can analyze for status of each row processed?

IHTH,

Posted: Tue Nov 15, 2005 9:31 am
by PhilHibbs
roy wrote:First thing that comes to my mind when you want to proces 1 row at a time is a real time environment where a web service DS job made with SOA webservices tool might be handy (but this might not be you'r case).
Way too many buzzwords for my liking! :P
In any case how may rows do you expect?
Is there any way of turning this to a batch process processing more then 1 row a time and perhaps building a control file you can analyze for status of each row processed?
Row counts will be somewhere in the 5 digits area. I don't understand about the batch process - my specific requirement is to process only one row at a time, so no, I can't make it into a batch process that processes multiple rows.

Posted: Tue Nov 15, 2005 10:01 am
by chulett
UtilityRunJob.

Posted: Tue Nov 15, 2005 10:47 am
by Bala R
You might find THIS similar post helpful.