Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to Create header, detail and trailer record in a file using talend

Hi,
I have N no of records in a table and write it into a positional file which has the following format:
Header record layout
-------------------------
currentdate 1-6
Detail record layout
------------------------
ename 1-10
esal 11-18
trailer layout
-----------------
Totalsal 1-10
sample output file
--------------------
2011-24-05
ganesh 0001000
shong 0002000
00003000
So my output file is, one header entry, one trailer entry and multiple detail entries.
Labels (2)
7 Replies
Anonymous
Not applicable
Author

Hi
You need to write the header, trailer and details entries into the same file one by one with the feature 'append source file'.
Best regards
Shong
Anonymous
Not applicable
Author

Can u plz put some screenshots? Because i can't able to implement this one.
Anonymous
Not applicable
Author

Hi
The job looks like:
extract the header data from a data source or use the tFixedFlowInput to define the header data --main-->tFileOutputPositional_1
|
onsubjobok
|
extract the Detail data from a data source or use the tFixedFlowInput to define the header data--main---tFileOutputPositional_2(write the records into the same file and check the option 'Append')
|
onsubjobok
|
extract the trailer data from a data source or use the tFixedFlowInput to define the header data--main---tFileOutputPositional_3(write the records into the same file and check the option 'Append')
Best regards
Shong
Anonymous
Not applicable
Author

Thanks for your valuable suggestions. I need a output file which has the following format:
Main Header (1st line)
Batch Header(2nd Line)
Record1 (3rd line)
Record 2 (4th line)
.
.
.
Record N (n+4th line)
Batch Trailer(n+5th line)
Batch Header(n+6th line)
Record1 ((n+7th line)
Record 2 (n+8th line)
.
.
.
Record N
Batch Trailer
FileTrailer(last line)
Main Header - contains the current date
Batch header - sequence number ( 1 for Header 1)
record - amount (fetch from db)
Batch trailer - (Batch Amount Total)
File Trailer - (File Amount Total)
N - no of records in a batch
Ex:
---
23/11/2011
1 (Batch No)
12 (record1)
8 (record2)
20 (Batch1 Amount Total)
2(Batch No)
30 (record3)
20 (record4)
50 (Batch2 Amount Total)
70 (File Amount overall Total)
Please reply ASAP. Thanks in advance.
Anonymous
Not applicable
Author

Any Updates?
Anonymous
Not applicable
Author

Hi
I have replied you and give an example job in previous post, have you tried to create the job? Do you understand the 'append' option?
Best regards
Shong
Anonymous
Not applicable
Author

I got the earlier one. But plz see the latest one. How can we populate dynamic dynamic batch with fixed set of records?