Page 1 of 1

Pass the value of a column as the filename

Posted: Fri Jan 11, 2013 4:41 am
by srinivas.nettalam
Please suggest a way to create a seq. file in the target with the name coming from input column.
I know the reverse is possible when we read the Seq.File ,the filename column can be selected.

Posted: Fri Jan 11, 2013 5:35 am
by ArndW
The filename for an output file must be either a constant or a parameter (or other variable or combination of types). Parameter values cannot be changed within a job, so you need to determine the filename through column values in a prior job, then pass that value to your job as a parameter.
How you determine this value is dependant upon several factors. The simplest way can be through a call to a shell program which returns the value. Alternatively you could write a DataStage job which determines this value and returns it as a user-return-code, which is then passed as a parameter to the next job.

Posted: Fri Jan 11, 2013 9:07 am
by chulett
There have been several posts showing how to use awk in an External Source stage to do that, here is one: viewtopic.php?t=141139

Haven't tried it myself.