Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
read records based on condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: read records based on condition
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    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Mon May 31, 2010 6:40 pm    Post subject: Re: read records based on condition
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: 6968
Location: porcelain throne

PostPosted: Mon May 31, 2010 7:04 pm    Post subject:
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: 6968
Location: porcelain throne

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

or look here
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 May 31, 2010 9:45 pm    Post subject:
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    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 how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts How do you create Eclipse based dialogs jasorn IBM Tools 0 Thu Aug 03, 2017 5:05 pm
No new posts Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us