Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

reading the input file or internal table?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: reading the input file or internal table?
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: 1825
Location: UK

PostPosted: Mon Sep 19, 2011 9:58 am    Post subject:
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

Site Director


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

PostPosted: Mon Sep 19, 2011 9:59 am    Post subject:
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    Post subject: Reply to: reading the input file or internal table?
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

Site Director


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

PostPosted: Mon Sep 19, 2011 10:39 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 1 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us