Combine two Files.....

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
gpbarsky
Participant
Posts: 160
Joined: Tue May 06, 2003 8:20 pm
Location: Argentina

Post by gpbarsky »

Hi.

When I had this case, I had to build two server jobs: one for the first time, with the "overwrite data" check in the seq. stage checked.

The other job for the next times, had this check not checked, and instead of this I had the "append data" check checked.

I had to do this in this way cause of the CR and LF characters, that I did not know how the file was comming. Besides, The omit last line check was also disturbing me.

I hope that this help you. Good luck [:)].


Guillermo P. Barsky
Buenos Aires - Argentina
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I'd use a Sequential File stage and a before-stage subroutine from the Transformer stage it feeds data into.
The before-stage subroutine uses ExecSH to execute the UNIX command cat file1 file2 > file3, and the Sequential File stage reads file3.
If your DataStage server is on Windows, the before-stage subroutine is ExecDOS and the command is type file1 file2 > file3
If you are on version 6 or later of DataStage, you could invoke this command as a filter program within the Sequential File stage, avoiding the need to run a before-stage subroutine.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Optico
Participant
Posts: 23
Joined: Thu Sep 18, 2003 9:32 am

Post by Optico »

Ray's suggestion is OK, but you have to beware that the first file in the concatenation ends with a line termination character (in DOS/Windows CrLf). Otherwise you'll loose the first record of the second file and the last record of the first file will look very funny indeed.



B. Sorensen,
Optico IT ApS
Peytot
Participant
Posts: 145
Joined: Wed Jun 04, 2003 7:56 am
Location: France

Post by Peytot »

You can use the stage 'Link Collector' if you would like to visialise the action.

Peytot
Post Reply