Running a job in a loop

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Running a job in a loop

Post 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.
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post 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,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post 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.
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

UtilityRunJob.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Bala R
Participant
Posts: 66
Joined: Mon May 30, 2005 9:52 pm

Post by Bala R »

You might find THIS similar post helpful.
Post Reply