Two files Matching Logic

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
Arun Balas
Member
Posts: 2
Joined: Sat Oct 30, 2010 2:42 pm

Two files Matching Logic

Post by Arun Balas » Sat Oct 30, 2010 3:01 pm

Can anyone please let me know which one of the file matching logic is efficient.

Having both the files in sorted order.

option 1:

if machval1 > machval2
read next of machfile2
if machval1 < machfval2
read next of Machfile1
if machval2 = matchval2
write into 3 fileread next of both file1, file2 and reapeat the para again..

option 2:

Here : READ-NAME-SHORT is one file and
COIP-CUSTOMER-NUMBER is from other file.

PERFORM 4201-READ-NAME-SHORT
THRU 4201-READ-NAME-SHORT-EXIT
UNTIL INP-CUSTOMER-NUMBER >= COIP-CUSTOMER-NUMBER
OR NAME-FILE-EOF.

IF INP-CUSTOMER-NUMBER = COIP-CUSTOMER-NUMBER
MOVE INP-NAME-SHORT TO COCO-FULL-NAME

Please let me know which option is efficient.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Sat Oct 30, 2010 6:35 pm

need to decide which process works.
then you need to run tests.
we have no idea what your machine looks like, how your shop is set up.

and I have little desire to comment on such abbreviated coding logic and attempt to make a decision on efficiency,
especially since I have no idea what you mean by efficient.

and depending on what manipulation is to be accomplished, a SORT solution may be better than a COBOL program written by a beginner.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Arun Balas
Member
Posts: 2
Joined: Sat Oct 30, 2010 2:42 pm

Post by Arun Balas » Sat Oct 30, 2010 7:56 pm

Hi Bren,

I have browsed and most of them used option 1 file matching logic but i guess option 2 looks even more simpler. There is not much coding lines involved too. Lets see others thoughts too on this.

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Mon Nov 01, 2010 12:39 pm

At my first glance over the option1 and optin 2 logics..
i dont see any major logic differene between option 1 and option 2.
It is simplay using PERFORM instead of IF condition. It dont expect any cost savings
over this.. In both cases , we need to read all the recods in both files.


As suggested by Dick, we better use existing tools like DFSORT, EASYTRIVE for this kind of match files applications.
Natarajan
Chennai

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others