need to get the count of unmatched records from two files
Moderators: Frank Yaeger, Moderator Group
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
need to get the count of unmatched records from two files
Hi,
I have two input files. Both having same LRECL and having only one field. I need to know whether all the records in file2 is there in the file1. If some records in file2 are missing in file1 then I need those records in Output file Or to get the number of output records in output file.
Please give me a solution JCL for the above need...
Thanks in Advance...
I have two input files. Both having same LRECL and having only one field. I need to know whether all the records in file2 is there in the file1. If some records in file2 are missing in file1 then I need those records in Output file Or to get the number of output records in output file.
Please give me a solution JCL for the above need...
Thanks in Advance...
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Please show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
And please let us know if you are using DFSORT or Syncsort or other. To determine if you're using DFSORT (from IBM) or Syncsort (from Syncsort, Inc), run the PGM=ICEMAN JOB, actually any PGM=SORT or PGM=ICEMAN JOB. Look at the SYSOUT output. If it has ICExxxs messages, you're using DFSORT. If it has WERxxxs messages, you're using Syncsort.
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=* <--- look at messages
//SORTIN DD *
//SORTOUT DD DUMMY
//SYSIN DD *
SORT FIELDS=COPY
/*
Regards,
Anuj
Anuj
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
The example files as follows,
File1 File2
10001 10001
10003 10002
10004 10004
10006 10005
after comparing above two files I should get 10002 and 10005 as output. Or we can get the count (i.e. 2) of file2 record that could not be found in file1.
The requirement is to check whether all the records in file2 are there in file1 or not.
Natarajan,
Please help me to write EASYTRIEVE code as I am eager but not known the same.
Thanks.
File1 File2
10001 10001
10003 10002
10004 10004
10006 10005
after comparing above two files I should get 10002 and 10005 as output. Or we can get the count (i.e. 2) of file2 record that could not be found in file1.
The requirement is to check whether all the records in file2 are there in file1 or not.
We are using DFSORTAnd please let me know if you are using DFSORT or Syncsort or other
Natarajan,
Please help me to write EASYTRIEVE code as I am eager but not known the same.
Thanks.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here are two ways to do this with DFSORT. The first job uses JOINKEYS which requires that you have the Nov, 2009 DFSORT PTF installed. The second job uses SELECT and does not require that PTF. I assumed your input files have RECFM=FB and LRECL=80, but the jobs can be changed appropriately for other attributes.
JOINKEYS job
SELECT job
JOINKEYS job
Code: Select all
//JK EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
10001
10003
10004
10006
//IN2 DD *
10001
10002
10004
10005
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=IN1,FIELDS=(1,5,A),SORTED
JOINKEYS F2=IN2,FIELDS=(1,5,A),SORTED
JOIN UNPAIRED,F2,ONLY
REFORMAT FIELDS=(F2:1,80)
OPTION COPY
/*
Code: Select all
//SPL EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
10001
10003
10004
10006
//IN2 DD *
10001
10002
10004
10005
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,5,CH) NODUPS USING(CTL3)
//CTL1CNTL DD *
INREC OVERLAY=(81:C'1')
//CTL2CNTL DD *
INREC OVERLAY=(81:C'2')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(81,1,CH,EQ,C'2'),
BUILD=(1,80)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page