Page 1 of 1

Unix Commands in DS for every input record

Posted: Sun Aug 12, 2012 2:09 am
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.

Posted: Sun Aug 12, 2012 2:25 am
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.

Posted: Sun Aug 12, 2012 5:12 am
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.

Posted: Sun Aug 12, 2012 9:05 am
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?

Posted: Sun Aug 12, 2012 7:06 pm
by dsnk
Thanks for your replies.

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