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

read records based on condition


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

New User


Joined: 21 May 2010
Posts: 2
Location: mysore

PostPosted: Mon May 31, 2010 5:53 pm
Reply with quote

hi all,

pgm currently reads two sequential files(sorted) and generates o/p file.
For each account read that meets at least 1 of the 12 criteria(conditions are not of much importance as of now) a record will be written to the new file.

how to go about this?


Thanks,
Saritha
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Mon May 31, 2010 6:10 pm
Reply with quote

Define "account"

What's in File1 ? how many records per account? sorted on what ?
What's in File2 ? how many records per account? sorted on what ?

And it probably is a normal merge program, something every cobol developer should have learned in the course "structured programming".
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Mon May 31, 2010 6:40 pm
Reply with quote

sarithakjumla wrote:
how to go about this?
Let me get this straight, as a "developer" with a mainframe skill in Cobol, you need help in writing a simple program?
I suggest you look into the IBM MAINFRAME FORUM
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 31, 2010 7:04 pm
Reply with quote

anybody that has to ask,
deserves what they get.

here is something to start with

Code:


PERFORM READ-FILE-ONE

PERFORM READ-FILE-TWO

PERFORM UNTIL FILE-ONE-EOF
          AND FILE-TWO-EOF

    EVALUATE  TRUE
        WHEN  FILE-ONE-EOF
              PERFORM PROCESS-FILE-TWO-ONLY
              PERFORM READ-FILE-TWO
        WHEN  FILE-TWO-EOF
              PERFORM PROCESS-FILE-ONE-ONLY
              PERFORM READ-FILE-ONE
        WHEN  OTHER
              EVALUATE  TRUE
                  WHEN  FILE-ONE-KEY = FILE-TWO-KEY
                        PERFORM PROCESS-FILE-MATCH
                        PERFORM READ-FILE-ONE
                        PERFORM READ-FILE-TWO
                  WHEN  FILE-ONE-KEY < FILE-TWO-KEY
                        PERFORM PROCESS-FILE-ONE-ONLY
                        PERFORM READ-FILE-ONE
                  WHEN  OTHER
                        PERFORM PROCESS-FILE-TWO-ONLY
                        PERFORM READ-FILE-TWO
              END-EVALUATE
     END-EVALUATE
END-PERFORM
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon May 31, 2010 7:07 pm
Reply with quote

or look here
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 May 31, 2010 9:45 pm
Reply with quote

Hello,

At the top of the COBOL part of the forum is a "Sticky" for 2-file match/merge (dbz has posted the direct link).

This has tested code that does what i believe you want to do. All you would do is modify for your particulars.
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 Error to read log with rexx CLIST & REXX 11
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
No new posts Join multiple records using splice DFSORT/ICETOOL 5
Search our Forums:

Back to Top