I have a five input files ,each input file has header, detail records and then trailer .Now trailer contains the amt which is sum of all detail records ,alongwith this amt field in trailer got one more field which says number of records ( this has number of details records + 1 (header record )) .
So now all this five input files we are going to merge in one oputput file which will have only one header ,all the details records of all the input files and one trailer at the end . I have done with merge and amounts add but got problem in number of record field of trailer ,it still has the count of all headers of all 5 input files ,instead it should be 4 less in final output file.
IF we have five detail records of amt 1000
file 1 trailer will have
AMT = 5000
Records= 6(Number of details + 1 header)
So same like above for other 4 input files
Now in output file trailer we will get
AMT = 25000 (Trailer amt add of 5 trailers)
Records =30 (which is wrong since we have one header in final output file ,so it should be 26 )