IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

reading the input file or internal table?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
irene hermia

New User


Joined: 19 Sep 2011
Posts: 2
Location: philippines

PostPosted: Mon Sep 19, 2011 9:54 am
Reply with quote

Hi i am new to cobol and i am having an exercise where i am going to read 2 input file (the balance master file and the transaction file) to produce a new report and at the same time update the balance master file with every transaction... I just want to know which is much better or efficient...reading the two files and compare it or make an internal table (either for the balance master or for the transaction file) and then do a search all.... hope you can help me.. thanks a lot...
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Sep 19, 2011 9:58 am
Reply with quote

How many records on each file?

Sounds like you have a basic 2-file match. Have you seen the 2-file match 'sticky' at the top of the cobol section of the forum? Take a copy and modify it to your needs. If you had programming education you must surely have done a 2 file match there - does not matter which language as the priciples are the same.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 19, 2011 9:59 am
Reply with quote

Hello,

Make sure both files are sorted on "the key". Then match the 2 files doing whatever is required when they match or do not match.

At the top of the COBOL part of the forum is a sample 2-file match/merge program that will probably work for your requirement. You may need to make a few modifications to do exactly what you want.

Take the time to understand how this code works as you may need a match/merge many times - sometimes the sort product will suffice and sometimes you will need code.
Back to top
View user's profile Send private message
irene hermia

New User


Joined: 19 Sep 2011
Posts: 2
Location: philippines

PostPosted: Mon Sep 19, 2011 10:19 am
Reply with quote

Hi,

Thanks for your help. I've seen the sample program. But for example I have 2 input file, is it better to read the 2 files and compare it or use an internal table?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 19, 2011 10:39 am
Reply with quote

Hello,

If you are going to succed in IT, you need to pay attention. . .

While neither of us said so specifiucally, we both mentoined using a 2-file match/merge. We replied this way because this is the better choice at least 99% of the time.

There is Rarely a reason to load an entire file into an internal array or open/close the file many times (another terrible approach that people ask about).

Quote:
Thanks for your help. I've seen the sample program. But for example I have 2 input file,
Yes, we knew this - it is why the code has been provided. . . It also appears that you did not closely look at the rather simple code.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 0
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top