Adding header,footer,trailer,end of file info in target

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
raj9176
Participant
Posts: 10
Joined: Tue Dec 06, 2005 3:46 am

Adding header,footer,trailer,end of file info in target

Post by raj9176 »

hi,
i wanted some tips on adding the default information what i have in the Header, Footer, Trailer, and End of file to the data(source) what i need to load in the target. In the End of file i need to calculate the total count of the rows loaded in the target that's the data rows. I am trying to do this using datastage Server Job.
Can anyone please send me some feedback on this problem.
Thanks and Regard's,
Raj
ameyvaidya
Charter Member
Charter Member
Posts: 166
Joined: Wed Mar 16, 2005 6:52 am
Location: Mumbai, India

Post by ameyvaidya »

Hi Raj9176,

Please post server job posts to the Server Forum.

For your issue, there are 2 solutions:

1. Pure DataStage:

(Inter process row buffering needs tobe switched on for this)
Generate header, detail and trailer information in 3 different streams in a single job. In the final transformer for each stream, concatenate all the data columns in the required target format. Add a derived field(Position) giving the order of this output in the final file. Hard Code it to 1 for Header, 2 for Detail, 3 for trailer.
(e.g.
input to Header transformer:
Col1,varchar
Col2,number
Col3, char

output of Header Transformer:
Position(Integer):=1
Col(varchar or longVarchar, 1024):=DQuote(in.Col1):", ": in.Col2: ", " : DQuote(in.Col3)

The other transformers will output the same columns
Collect outputs of all transformers using Link collector; Sort it using the Position as the sort key. and pass just the Col Column to the target sequential file.

2. DataStage+ OS:

Create Seperate files for Header, Detail and trailer and in the After Job Subroutine, execute a DOS Command:

Code: Select all

type headerfile detailfile trailerfile >finalfile
IHTH
Amey Vaidya<i>
I am rarely happier than when spending an entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.</i>
<i>- Douglas Adams</i>
Post Reply