Concatenate/append a single string that resides in one file.

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
tbtcust
Premium Member
Premium Member
Posts: 230
Joined: Tue Mar 04, 2008 9:07 am

Concatenate/append a single string that resides in one file.

Post by tbtcust »

Hello all.

I need to concatenate/append a single string that resides in one file to every record in three separate text files. These three file have very similar names. I need to be sure that all records remain in their respective files.

Is it possible to have one job handle all three files without giving there specific names?

Thanks in advance for any help.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No.

DataStage lacks an RMM (read my mind) stage. You will have to tell it the file names. However, one job could be created with the file name set as a job parameter, if all three files have the same structure or you use the Schema File property (parameterize the schema file name too).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tbtcust
Premium Member
Premium Member
Posts: 230
Joined: Tue Mar 04, 2008 9:07 am

Post by tbtcust »

Thank you ray. Since the Seq Stage can handle files patterns I thought there could be a solution.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

File Patterns are a source option, not a target option... reads, not writes.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

If all three files meet the same file pattern then yes, you can use the sequential file stage to pick up all three, you will then need the env var APT_IMPORT_FILE_PATTERN_AS_FILESET (or something like that) and the File Name Column stage option to expand the file patterns in to actual names.

Alternatively, if the three names are always the same in each run, you can just add three FileName options.

A Join stage with no key should give the cartesian join you are looking for (assuming it is happy to run with no key).

In order to put them back out to each file, as long as you know how to differentiate, the filter or transform stages can do the trick
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... appended to each record, almost missed that part. If you wanted to work outside of a job, this could be done in shell script. Seems like you could pick up the one record with a Lookup using a 'hard coded' key value as well.
-craig

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