Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort/Merge 1

Status
Not open for further replies.

mic2740

Technical User
Mar 6, 2001
5
US
For the problem I have to do, I know I have to use one of these, but I'm not sure which way I need to do it. This is my problem:
I have to create a telephone bill. I have a master file that has the customer phone number, name, address, and monthly charge. My transaction file contains the caller's phone number, the called phone number, number of minutes of the call, and a charge (which I assume is the per minute charge). The master file is in sequence by phone number but the transaction file isn't in any order. I need to create a monthly bill for each customer, but not sure if I need to sort, merge, or both.
Thanks!
Michelle
 
Hi Michelle,

You're right, you have to sort the transaction file in cust p# and date order, then match the mfile & tfile recs. This is called a file match. The one you'll be doing is a 2 file match, but you can have an n file match. The 2 file match is a special case of such. If you have the time it might be fun and helpful to develope a general solution to the n file match.

The file match and control break problems account for easily 90% of batch processing solutions in the DP industry, so it may be worth the extra effort.

Good luck, Jack.
 
Although learning the COBOL sort syntax is a good idea, you may find a utility with your OS that will do a file sort faster with less resources.

You would use the utility against the unsorted file to create a temporary file that is used for input into your COBOL program and then delete the temporary file upon completion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top