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
 

 

Handling three files in cobol program simultaneously

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

New User


Joined: 09 Oct 2005
Posts: 1

PostPosted: Sun Oct 09, 2005 12:17 pm    Post subject: Handling three files in cobol program simultaneously
Reply with quote

hi,

I have a doubt regarding handling three files simultaneously inside a cobol program.The program has to generate a report using the three files and these files have the same key.But the records in the files do not have a one to one correspondence.How can we handle them efficiently outside the program ie in a JCl so as to minimize the complexity of the logic?
Back to top
View user's profile Send private message

Sridevi_C

Active User


Joined: 22 Sep 2005
Posts: 104
Location: Concord, New Hampshire, USA.

PostPosted: Sun Oct 09, 2005 10:16 pm    Post subject: Re: Handling three files in cobol program simultaneously
Reply with quote

Hi,
You can SORT and MERGE in JCL. Duplicates, if any and if you need to eliminate SUM FIELDS = NONE can be used.
Regards,
Sridevi.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Oct 09, 2005 11:40 pm    Post subject:
Reply with quote

You didn't say how the rpt was to be written. If all 3 recs are needed to generate a rpt line you can do something like this, provided all 3 files are sorted on the same key.
Code:

Do a priming read of all 3 files.
Perf process-rpt until eof on any file

In process-rpt:
    check for all 3 keys equal and save hi key
    evaluate true
    when 3 keys equal
             perf print rpt line
             perf read 3 files     
    when key1 < hi key
            perf read file1   
    when key2 < hi key
            perf read file2
    when key3 < hi key
            perf read file2
    end-eval

P.S. This approach will work for 3 or more IP files.
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 DB2 Program abending without giving a... rahulgarg14 DB2 3 Mon May 29, 2017 8:10 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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