Pass the value of a column as the filename

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
srinivas.nettalam
Participant
Posts: 134
Joined: Tue Jun 15, 2010 2:10 am
Location: Bangalore

Pass the value of a column as the filename

Post 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.
N.Srinivas
India.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

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