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
 

 

Program needed to compare the records of flat file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Wed Mar 01, 2006 1:27 pm    Post subject: Program needed to compare the records of flat file
Reply with quote

hi frds i need a program from u.i hav a flat file n a master file.i need to compare the records of flat file with that of master file.if it does not exist i hav to write it in the mater file.can any one suggest optimum code.
i tried comparing the record of flat file with all the records of master file and so on.but it luks lenghty.can any one provide the code.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Mar 01, 2006 7:49 pm    Post subject: Re: vs cobol-II program needed
Reply with quote

stly

Step 1. If not already, sort master file and flat file by record key

Step 2. Pseudo code

Code:

    perform read-old-master-file
    perform read-flat-file

    perform
      until old-master-file-eof
      and   flat-file-eof
        if master-file-key = flat-file-key
        then
            perform write-from-old-master-file
            perform read-old-master-file
            perform read-flat-file
        else
            if master-file-key > flat-file-key
            then
                perform write-from-flat-file
                perform read-flat-file
            else
                perform write-from-old-master-file
                perform read-old-master-file
            end-if
        end-if
     end-perform.

Read-old-master-file.
    Read old-master-file
        At end
            Move ?y? to old-master-file-eof
            Move high-key-value to master-file-key.
Read-flat-file.
    Read flat-file
        At end
            Move ?y? to flat-file-eof
            Move high-key-value to flat-file-key.
Write-from-old-master-file.
    Write new-master-file from old-master-file.
Write-from-flat-file.
    Write new-master-file from flat-file.




Dave
Back to top
View user's profile Send private message
stly
Warnings : 1

New User


Joined: 25 Jul 2005
Posts: 93

PostPosted: Tue Mar 07, 2006 1:44 pm    Post subject:
Reply with quote

thank u very much
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 287
Location: Basel, Switzerland

PostPosted: Fri Mar 10, 2006 5:57 pm    Post subject:
Reply with quote

hy stly,

why write a program?
use utilities instead...

i.e. dfsort

merge both files, sort them and omit all duplicates...

martin9
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


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