View previous topic :: View next topic
|
Author |
Message |
rajanish
New User
Joined: 02 May 2006 Posts: 7 Location: Charlotte, NC, US
|
|
|
|
Hi,
I am currently working on a Reformatting code, I receive a input transaction file having some account & amount fields, Using this i create a o/p file which will add up the amounts for a particular account and then populate a header with the amount total followed by the list of detail transactions, I can have multiple headers in my file each having a set of detail records.
When populating the header i need to know to total amount & all the total no of detail record having the same account in advance. because I need my header written first then only i write the detail records in my o/p file. Also I cant store the individual transactions in an array as the file is very huge its having around 1 Million records.
I can create a header without the summary information(Amount total) and then read the file again just to update the header.
Is there a better solution.
Thanks in advance, I would greatly appreciate your help.
Regards
Rajanish |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Rajanish,
What is the max number of detail rrecords you are going to have per header record? This would be the number you would have to store is a COBOL table, not the entire transaction file.
The transaction file should be sorted by account number prior to processing.
Also you might look at using DFSORT for this. Frank Yaeger of the DFSORT/ICETOOL forum can probably give you a DFSORT solution.
Dave |
|
Back to top |
|
|
rajanish
New User
Joined: 02 May 2006 Posts: 7 Location: Charlotte, NC, US
|
|
|
|
Thanks Dave,
My Program can have all the records summarized in a single header or can have 100 headers, It all depends on the file i receive.
Anyway I will try looking at DFSORT. |
|
Back to top |
|
|
reddy307 Currently Banned New User
Joined: 09 Jun 2006 Posts: 18
|
|
|
|
by using DFSORT u can achieve it
try the following code to summarise the fields
sort fields=(starting pos, length,format,a/d) this is of ACCOUNT NO
Sum fields=(the fields that u need to summarise)
then u will get the summarised fields for each acct no
then u can use that in ur COBOL pgm
Regards
Reddy |
|
Back to top |
|
|
rajanish
New User
Joined: 02 May 2006 Posts: 7 Location: Charlotte, NC, US
|
|
|
|
Thank you. |
|
Back to top |
|
|
|