Page 1 of 1

Sequential File Header with Record Terminator

Posted: Wed Jan 16, 2013 9:05 am
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

Posted: Wed Jan 16, 2013 10:09 am
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

Posted: Wed Jan 16, 2013 11:32 am
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}