Page 1 of 1

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

Posted: Wed Dec 07, 2005 5:04 am
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

Posted: Wed Dec 07, 2005 12:38 pm
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