Run job for each row in sequential file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
mab_arif16
Charter Member
Charter Member
Posts: 87
Joined: Sat Mar 18, 2006 11:45 pm

Run job for each row in sequential file

Post by mab_arif16 »

I have found several posts on the topic but as I am new to datastage probably I dont find them quite useful
I have a sequential file with 2 columns and 10 rows
I wish to call a job one time for each row and pass the columns/values as parameters to that job.
If possible please include a breif detail about the procedure or stages to use .
Thanks
Arif
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You an use Looping activity in Job Sequence to have a loop for 10 times and pass the value of n to the job 1-10. So that you can retrive nth row for each iteration. Pass on this value either as UserStatus or write into an external file and read it and pass it as command output through Execute command activity.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
There are several options to run a job multipe times depending on the number of rows you have in a file and passing the fields of that file as parameters to the invoked file.

1. DS Basic job control.
2. Using Sequence job with loop activity as kumar_s mentioned.
3. Reading the file in a Server job and issue the DSRunJob() routine in a transformer stage.

There are probably more options.

Both options of 2 & 3 are pure sequential runs of each job iteration you invoke (that job may be a parallel one).

Option 1 allows parallel execution (running 10 instances of the desired job,requires also a bit planning on the invoked job + making it a multi instance job), but can also be sequential ()
and this allows the most flexible solution.

If you give more details on what you need to acomplish we might be able to point to the prefered solution for you, but till then either way could do the job and the one your more comfortable with will do.

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
mab_arif16
Charter Member
Charter Member
Posts: 87
Joined: Sat Mar 18, 2006 11:45 pm

Post by mab_arif16 »

kumar_s wrote:You an use Looping activity in Job Sequence to have a loop for 10 times and pass the value of n to the job 1-10. So that you can retrive nth row for each iteration. Pass on this value either as UserStatus or write into an external file and read it and pass it as command output through Execute command activity.
Thanks for the response I used the execute command stage but for passing two parameters I had to use two execute command stages ,as I can only pass one parameter from command stage using ecm.commandouptput.
Can you elaborate the userstatus method.
As Roy suggested I tried the server method too.It would be helpful if you elaborate the DSBasic Control job because I need to do it in parallel.
Thanks
Arif
Post Reply