on 07-28-2016 11:22 AM
Hi,
I have a file structure like below with fixed length.
FileHeader
field1,field2,...
BatchHeader
field1,field2,....
DetailRecord
field1,field2,....
BatchTrailer
field1,field2,....
FileTrailer
field1,field2,....
File Header and File Trailer repeats once in the file. Batch Header, Detail Record and Batch Trailer repeat multiple times. May be take it as for each employee the Batch Header, Detail Record and Batch Trailer gets repeated with multiple line items (Detail Record ) for each employee.
FH0012016 28072016
BH0165757 28072016 1st
DT0165757 28072016 Richa 388893 34.09
DT0265757 28072016 Tina 385693 36.09
BT0165757 28072016 1st
BH0234345 29072016 2nd
DT0134345 28072016 Dilip 388893 44.09
BT0165757 28072016 2nd
FT0012016 28072016
I tried placing the file in NFS location and pick with file adapter , FCC is not working. Kindly help me how to pick the file with this structure from sender location.
Regards,
Suman
Hi All,
'FileHeader,1,BatchHeader,*,DetailRecord,*,BatchTrailer,*,FileTrailer,1'
RecordSet Sequence parameter be Variable
This worked for my case.
Regards,
Suman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suman,
It seems to be a very simple file structure. can you please share your FCC your are using so that prominent answer can be given.
Thanks,
Apu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Apu,
In channel ,
Recordset Structure : FileHeader,1,BatchHeader,1,DetailRecord,*,BatchTrailer,1,FileTrailer,1
The same is repeated for others.
It works fine when i have the below.
FH0012016 28072016
BH0165757 28072016 1st
DT0165757 28072016 Richa 388893 34.09
BT0165757 28072016 1st
FT0012016 28072016
When Batch Header, Detail Record and Batch Trailer gets repeated , it fails with error . So when the next batch starts , it fails.
Hi Suman,
Looking into structure now its bit clear to me. To pick it simply without and custom module your source structure should looks like below as you dont know how many times this chunk will occur -
Batch Header
Detail Record 0.*
Batch Trailer
Structure should looks like -
FileHeader 0.1
BHDTBTRecord 0.*
FileTrailer 0.1
FCC
FileHeader as you have done currently
BHDTBTRecord.fieldSeparator 'nl'
BHDTBTRecord.endSeparator 'nl'
FileTrailer as you have done
Now you should get a separate BHDTBTRecord tag for all BH, DT and DT like -
<BHDTBTRecord>BH0165757 28072016</BHDTBTRecord>
<BHDTBTRecord>DT0165757 28072016 Richa 388893 34.09</BHDTBTRecord>
<BHDTBTRecord>DT0265757 28072016 Tina 385693 36.09</BHDTBTRecord>
<BHDTBTRecord>BT0165757 28072016</BHDTBTRecord>
Now use an UDF ... split each record by space and store in array/arrayList as per requirement. Reading first 2 characters of arr[0] will understand whether its Batch Header/Detail Record/Batch Trailer and map to the target accordingly from the UDF using multiple ResultList object.
By the way how did you use keyField is it fixed.
Thanks,
Apu
Hi Suman,
1. Please do FCC & have your 1st structure (All nodes at same level).
2. For this 1st structure you can apply java mapping to have DetailRecord under your BatchHeader record.
Let the RecordSet Sequence parameter be Variable while doing FCC in 1st step.
Regards,
Mohammed Farooq
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Suman,
Check the below approach
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.