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
 

 

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: 1280
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: 6966
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: 6966
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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