View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Fri May 14, 2004 9:50 am Post subject: Need help with file compare logic in COBOL |
|
|
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 |
|
 |
SureshKumar Intermediate
Joined: 23 Jan 2003 Posts: 211 Topics: 21
|
Posted: Fri May 14, 2004 10:01 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12381 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Fri May 14, 2004 10:07 am Post subject: |
|
|
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 |
|
 |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Fri May 14, 2004 10:21 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12381 Topics: 75 Location: San Jose
|
Posted: Fri May 14, 2004 11:09 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12381 Topics: 75 Location: San Jose
|
Posted: Fri May 14, 2004 3:16 pm Post subject: |
|
|
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 |
|
 |
|
|