How to create header and trailer record in output 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
rajudx
Participant
Posts: 45
Joined: Tue Nov 14, 2006 1:58 pm
Location: NJ

How to create header and trailer record in output file

Post by rajudx »

I need to crerate header and trailer record in output file.

i.e HDR2009040210PM CST
Pavan,23,45,67,78
Kiran,34,56,78,9
Kim,45,67,89,08
TRL00003

Please let me know how we can implement above logic.
Ran
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Do you want to create header and trailer for each set of records in your input? Or only one header and one trailer row?
You are the creator of your destiny - Swami Vivekananda
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

Code: Select all

Row Gen      ---   XFM   ---
                            |
File -----------------   Funnel (Sequence)   ----Output
                            |
Row Gen      ---   XFM   ---
*Edited* Metadata for the 3 sources should be the same (1 field). So, read the entire row as one field from your source and do the concatenations the way you wish for the Header/Trailer in the Transformer (XFM) stages...
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a before-job subroutine you could (for example) echo the header record into the file using the > redirection operator. The job appends detail records to the file. An after-job subroutine appends the trailer to the file, perhaps using echo again, this time with the >> redirection operator.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mcolen
Premium Member
Premium Member
Posts: 31
Joined: Wed Aug 11, 2004 8:59 am
Location: Florida

Post by mcolen »

you could always create header, trailer, and detail in a seperate file and concat to a new file name in an after job sequence if you need counts for any create an aggregation
Post Reply