Unix Commands in DS for every input record

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
dsnk
Premium Member
Premium Member
Posts: 10
Joined: Fri Jun 15, 2012 12:11 am
Location: USA

Unix Commands in DS for every input record

Post by dsnk »

Hi,

I have a requirement where in, I need to execute UNIX command for every input record from a sequential file. The output of this command has to undergo transformation.

This is one of the sample :

I need to generate a sample report of space available and used for Each UNIX directory, list of directories is fed from sequential file. Based on the usage and available space, I need to generate a report as an output file.

Please guide me the feasible options.

Thank You.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Although I feel pretty strongly that this type of processing is best done outside of DataStage - a script would do this much more efficiently than a DataStage job - the simplest way to do this would be to use a Server job and in the transform stage call up ExecSH() to create a shell and execute your command along with the parameters, which come from the stage's columns.
Note that this will create a shell and close it. For each row in the file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a parallel job you should be able to use an External Filter stage. This executes a well-formed UNIX command. Its sdtin is mapped from the stage's input link, and its stdout is mapped to the stage's output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

I agree with ArndW, do that stuff outside of datastage.

Think of the impact on the system for opening and closing a shell for each line in that sequential file.

What transformation logic do you need to do and what report is the outcome?
dsnk
Premium Member
Premium Member
Posts: 10
Joined: Fri Jun 15, 2012 12:11 am
Location: USA

Post by dsnk »

Thanks for your replies.

As suggested, I'll go with UNIX Shell script.
Post Reply