Sequence job start loop from SQL result

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
rjhankey
Premium Member
Premium Member
Posts: 28
Joined: Mon Sep 19, 2011 2:04 pm
Location: Portage MI

Sequence job start loop from SQL result

Post by rjhankey »

As mentioned in this previous post, I've created a Parallel job that can write to multiple files based on job parameters of brand and country, resulting in multiple files with a filename of <country>_<brand>.csv

It seems I'm very close to having the solution, I just need to determine how to have the loop construct in the Sequence job accept the country and brand values from a SQL query. Those values will vary after each monthly run, so the simplest approach is to execute a select distinct on the data results table. The part I'm having trouble figuring out is how to get those values passed along to the loop construct.

I know it was suggested to use a Server job in prior posts, just wondering if there's a simple approach to getting the loop construct to recognize values coming in from a SQL query.

Thanks!

-Russ
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Write the output to a file. Use an Execute Command activity to read the file and translate the line terminators to delimiters such as commas that the StartLoop activity can use. Ideally strip the final (empty) line too in the Execute Command activity. The command output becomes the delimited string that the StartLoop activity uses.
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 »

Split out to your own post.

This may help as well: viewtopic.php?t=127425
-craig

"You can never have too many knives" -- Logan Nine Fingers
rjhankey
Premium Member
Premium Member
Posts: 28
Joined: Mon Sep 19, 2011 2:04 pm
Location: Portage MI

Post by rjhankey »

Thanks Craig -- I took a look at your related topic, and I may try that approach as well. I ended up writing all of the output to a single file, then breaking out to a shell script using sed and awk to split that file into pieces. When I get some time to revisit this solution though, I'll try the more DataStage-centric approach!
Post Reply