MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with file compare logic in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Fri May 14, 2004 9:50 am    Post subject: Need help with file compare logic in COBOL Reply with quote

Hi ,
I need help with a file compare logic in COBOL.

2 Files.
FileA - No duplicate keys
ex:
10
20
30
40
Fileb - Duplicate keys
10
10
10
30
30
30

Ouput :
All matching records in fileb with filea and records in filea and not fileb
10
10
10
20
30
30
30
40

Could you please help me with this code.

Thanks,
Vijay
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Fri May 14, 2004 10:01 am    Post subject: Reply with quote

Vijay,
Are you sure Cobol is the way you need. This will be simple and clean to do it in a JCL and use the files in the program. This topic is very frequently discussed in the forum and a search can give you all the code and options available.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Fri May 14, 2004 10:06 am    Post subject: Reply with quote

Vijay,

As Suresh suggested please search before posting. Check this link for matching logic

http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=match

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Fri May 14, 2004 10:07 am    Post subject: Reply with quote

Yes Suresh.I need to do this in COBOL only because I'd to lot more processing ike reporting other than just compare


Thanks,
VIjay
Back to top
View user's profile Send private message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Fri May 14, 2004 10:21 am    Post subject: Reply with quote

Thanks for the reply.I looked at the logic ,looks like the logic works only if both the files have unique records.For me filea has unique records and fileb has duplicates

Thanks,
Vijay
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Fri May 14, 2004 11:09 am    Post subject: Reply with quote

Vijay,

Did you look at the link posted by me? If you looked at it then with minor changes it will fit for your requirement.Both easytrieve and cobol solutions need just a minor change.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12381
Topics: 75
Location: San Jose

PostPosted: Fri May 14, 2004 3:16 pm    Post subject: Reply with quote

vijay,

A job which will take less than 2 mins to write.

Code:

//STEP0100 EXEC PGM=EZTPA00                                   
//STEPLIB  DD DSN=EASYTREV.LOADLIB,                 
//            DISP=SHR                                       
//SYSPRINT DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//SYSSNAP  DD SYSOUT=*                                       
//SYSUDUMP DD SYSOUT=*                                       
//INFILE1  DD *                                               
10                                                           
20                                                           
30                                                           
40                                                           
//INFILE2  DD *                                               
10                                                           
10                                                           
10                                                           
30                                                           
30                                                           
30                                                           
//OUTPUT   DD SYSOUT=*,                                       
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)               
//*                                                           
//SYSIN    DD *                                               
                                                             
  FILE INFILE1                                               
       IN1-KEY          01 002 A                             
                                                             
  FILE INFILE2                                               
       IN2-KEY          01 002 A                             
                                                             
                                                             
  FILE OUTPUT  FB(0 0)                                       
                                                             
                                                                       
***********************************************************************
* MAINLINE                                                            *
***********************************************************************
                                                                       
 JOB INPUT (INFILE1   KEY (IN1-KEY)   +                               
            INFILE2   KEY (IN2-KEY))                                   
                                                                       
   IF MATCHED                                                         
          PUT OUTPUT FROM INFILE2                                     
   ELSE-IF INFILE1                                                     
          PUT OUTPUT FROM INFILE1                                     
   END-IF                                                             
                                                                       
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group