Parallel Equivalent to UtilityRunJob

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
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Parallel Equivalent to UtilityRunJob

Post by Developer9 »

Is there a Parallel routine or function equivalent to UtilityRunJob server routine? I need to run a datastage parallel job from another job.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not unless you write one, as far as I know. If you really need to do this, I'd probably look into using it via a BASIC Transformer in a Server Shared Container. Or if there's no burning need for the driving job to be a PX job, create it as a Server job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What Craig said, but stronger.

If you were to write your own you would need to encapsulate the DataStage C API in order to have the ability to set parameters, request runs, discover status, and so on.

A review of the source code for UtilityRunJob will give you the logic.

You would also need to take steps to ensure that the routine is not called from every node, since only once specific instance of a DataStage job can be run at any one time. (Specific instance includes multi-instance with a specific invocation ID.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Post by Developer9 »

Chulett thanks for the reply, my input files has datastage job names and i have a server job which reads the file and runs the job in the file. We are now getting a request for using multiple files with multiple job names, i didnt see any option in server jobs to handle file patterns, if my server job supports reading multiple files then this will be my first preference. any thoughts??
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

From what I recall, there isn't a direct option in the Server Sequential File stage like there is on the Parallel side to read files via a File Pattern. However, it can be handled via the Filter option. Any command line option that can deliver rows to standard out will feed the stage as if it was reading a single file, so (for example) something as simple as:

Code: Select all

cat MyFile*.txt
Could be made to work with your pattern of choice. Now, realize that if you have a header record in each file then it will need to be dealt with in some fashion. We've used Perl or awk in the past to read files via a pattern and strip the header from each on the way in. It also becomes a little trickier if you need to know what filename each record came from but again something like Perl or awk would allow you to add that as part of each record, a new column with the filename. Heck, we even had one developer do all that in a Korn shell script... it all depends on where your skill sets are and what you feel comfortable maintaining.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As Craig notes, use a server job. In the Sequential File stage specify that it uses a Filter command and setup the filter command as cat file1 file2 file3 ...

The stage will read stdout of the filter command rather than the file name you (have to) supply.

Add downstream logic to discard any header rows. Use extended column properties in the Sequential File stage to handle any "missing" columns from those header rows, or perhaps read the whole line into a single VarChar and parse in a downstream Transformer stage.
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 »

It is worth noting (again) that the filename property is required. So rather than putting something meaningless in there, understand that the stage will automatically combine it with the filter command to produce the stream of data that the stage will read.

Meaning, you should be able to put your pathed filename with whatever pattern you need as the filename and "cat" by itself as the Filter and it will automatically combine the two to "cat /your/files/pattern*.*" when it executes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply