Create New trailer with count as per the detail record type
Posted: Sun Sep 04, 2011 8:51 pm
Hi ,
I have a requirement in which i have two types of detail record, i need to create a trailer with with the counts of each detail record and also the total count.
Original file :
1XXXXX22434
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
Expected Output :
1XXXXX22434 --> Header
2XXXA dsfdaf gfgdfgh -->Detail record with indicator 2
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh -->Detail record with indicator 3
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
4000000004000000003000000007 --- > trailer should start with 4
The trailer should have the count of each type ( type 2 and type 3)detail record separately and also the total count of the detail record (type2 +type 3).
Header record will start with 1,the first set of detail records with 2 , next set of detail records will start with 3 and the trailer will be 4.
I was able to bring the total count in the trailer.. but i am not sure about bringing the separate count as per the detail record.Could someone please help me with this.
Thanks!
I have a requirement in which i have two types of detail record, i need to create a trailer with with the counts of each detail record and also the total count.
Original file :
1XXXXX22434
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
Expected Output :
1XXXXX22434 --> Header
2XXXA dsfdaf gfgdfgh -->Detail record with indicator 2
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
2XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh -->Detail record with indicator 3
3XXXA dsfdaf gfgdfgh
3XXXA dsfdaf gfgdfgh
4000000004000000003000000007 --- > trailer should start with 4
The trailer should have the count of each type ( type 2 and type 3)detail record separately and also the total count of the detail record (type2 +type 3).
Header record will start with 1,the first set of detail records with 2 , next set of detail records will start with 3 and the trailer will be 4.
I was able to bring the total count in the trailer.. but i am not sure about bringing the separate count as per the detail record.Could someone please help me with this.
Thanks!