Page 1 of 1

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

Posted: Tue Nov 03, 2009 2:04 pm
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.

Posted: Tue Nov 03, 2009 2:17 pm
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).

Posted: Tue Nov 03, 2009 2:24 pm
by tbtcust
Thank you ray. Since the Seq Stage can handle files patterns I thought there could be a solution.

Posted: Tue Nov 03, 2009 2:53 pm
by chulett
File Patterns are a source option, not a target option... reads, not writes.

Posted: Tue Nov 03, 2009 2:54 pm
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

Posted: Tue Nov 03, 2009 3:25 pm
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.