Sequential File Header with Record Terminator

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
campbellj2
Participant
Posts: 8
Joined: Fri May 16, 2008 12:13 pm

Sequential File Header with Record Terminator

Post by campbellj2 »

I have a requirement from a vendor who wants record terminator characters on the header line as well as the detail data rows. They vendor requires the string "!##!" at the end of each record including the header. So the sample output should resemble:


Name|Address|Phone|!##!
Mary|1 Elm St.|000-0000|!##!
Bob|2 Front St|000-0000|!##!
Jack|1 2nd Ave|000-0000|!##!

I can create the record terminator for each detal row by appending their terminator string to the last field of data. Is there a way to accomplish this for the header row as well. I realize that I can save a header template files and then append the data by itself on each run. That isn't very flexible for adding/removing columns from the file. Any other ideas would be greatly appreciated.

Thanks,
Joe
sathya_anjan
Participant
Posts: 20
Joined: Tue Feb 02, 2010 4:49 am
Location: United Kingdom

Post by sathya_anjan »

Joe,

Generate a dummy header row using the Transformer. You can then use a Link Collector Stage to merge Header and Detail

Thanks

Sathya
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you wish to auto-generate the header row then the simplest solution would be to not add this terminator in the DataStage flow, but subsequently in an after-job command or from a job-sequence, simply use something like

Code: Select all

sed -i 's/$/\!\#\#\!/' {yourfile}
Post Reply