compare two files:
Moderators: Frank Yaeger, Moderator Group
compare two files:
Hi
I need to compare two files, which has number of tranasctions like shown below..
one file has more records than the other one and in random order.
I want the common records in one output file and the
uncommon records in other file.
FILE 1:
0000000000
7CM ABC411..
7CL EFD357..
7AC DCB682..
FILE 2:
7CM ABC411..
7CL EFD357..
7CL BNJ281..
7CM MNG282..
7AC DCB682..
Output as:
FILE 1:
0000000000
7CM ABC411..
7CL EFD357..
7AC DCB682..
FILE 2:
7CL BNJ281..
7CM MNG282..
Thanks
Anju
I need to compare two files, which has number of tranasctions like shown below..
one file has more records than the other one and in random order.
I want the common records in one output file and the
uncommon records in other file.
FILE 1:
0000000000
7CM ABC411..
7CL EFD357..
7AC DCB682..
FILE 2:
7CM ABC411..
7CL EFD357..
7CL BNJ281..
7CM MNG282..
7AC DCB682..
Output as:
FILE 1:
0000000000
7CM ABC411..
7CL EFD357..
7AC DCB682..
FILE 2:
7CL BNJ281..
7CM MNG282..
Thanks
Anju
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
0000000000 is an "uncommon" record, so by your "rules" it should be in output file2, not in output file1 as you show. Given that, here's a DFSORT/ICETOOL job that will do what you asked for. I assumed you wanted to check for duplicates on positions 1-12, but the ON field can be changed for other situations as appropriate.
OUT1 will have:
OUT2 will have:
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CON DD DSN=... input file1
// DD DSN=... input file2
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//TOOLIN DD *
SELECT FROM(CON) TO(OUT1) ON(1,12,CH) FIRSTDUP
SELECT FROM(CON) TO(OUT2) ON(1,12,CH) NODUPS
/*
Code: Select all
7AC DCB682..
7CL EFD357..
7CM ABC411..
Code: Select all
0000000000
7CL BNJ281..
7CM MNG282..
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
compare two files:
Hi Frank
My requirement has changed a bit.
I need to compare one PS file with record lenght 58,with VSAM file whose key lenght is 10, its a KSDS.
Please let me know wht to do, i tried using the same code but its is not working..
Regards
Ajnu
My requirement has changed a bit.
I need to compare one PS file with record lenght 58,with VSAM file whose key lenght is 10, its a KSDS.
Please let me know wht to do, i tried using the same code but its is not working..
Regards
Ajnu
Last edited by anilanju on Mon Feb 23, 2009 8:11 pm, edited 2 times in total.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
RC=20 usually indicates a message data set is missing. That would be TOOLMSG or DFSMSG.
Since your requirement has changed to using a VSAM file and non-VSAM file as input, you won't be able to concatenate them.
If you need more help with this, then since your requirements have changed, you need to show me a new example of your input records and what you expect for output. Give me all of the details like RECFM and LRECL of the ps file, starting position, length and format of all the relevant fields in both input files, etc.
Since your requirement has changed to using a VSAM file and non-VSAM file as input, you won't be able to concatenate them.
If you need more help with this, then since your requirements have changed, you need to show me a new example of your input records and what you expect for output. Give me all of the details like RECFM and LRECL of the ps file, starting position, length and format of all the relevant fields in both input files, etc.
Then perhaps you should have taken the time to give the needed information so I could help you more quickly.Please its urgent..
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
Compare two files
Hi
This is the example i am the output along with the information:
PS FILE : LREC:58, recfm:FB
0000000000
7CM ABC411
7CL EFD357
7AC DCB682
7CL BNJ281
7CM MNG282
VSAM 2: Key lenght 10, LREC=58. KSDS
7CM ABC411
7CL BNJ281
PS file has large number of records, while VSAM has few records.
I need UNCOMMON RECORDS in my output as:
PS file:LREC=58, RECFM:FB
0000000000
7CL EFD357
7AC DCB682
7CM MNG282
Starting position is 1, and last position is 10.
Regards
Anju
This is the example i am the output along with the information:
PS FILE : LREC:58, recfm:FB
0000000000
7CM ABC411
7CL EFD357
7AC DCB682
7CL BNJ281
7CM MNG282
VSAM 2: Key lenght 10, LREC=58. KSDS
7CM ABC411
7CL BNJ281
PS file has large number of records, while VSAM has few records.
I need UNCOMMON RECORDS in my output as:
PS file:LREC=58, RECFM:FB
0000000000
7CL EFD357
7AC DCB682
7CM MNG282
Starting position is 1, and last position is 10.
Regards
Anju
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed the output records could be sorted in key order. If you need them in their original order, you'll need another step.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... ps input file (FB/58)
//IN2 DD DSN=.... VSAM input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... ps output file (FB/58)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2) VSAMTYPE(F)
SELECT FROM(T1) TO(OUT) ON(1,10,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(59:C'1')
/*
//CTL2CNTL DD *
INREC OVERLAY=(59:C'2')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(59,1,CH,EQ,C'2'),
BUILD=(1,58)
/*
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
Hi
This code worked properly...thanks a lot
//STEP0010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//CON DD DSN=in1
// DD DSN=in2
//OUT1 DD DSN=out1
//TOOLIN DD *
SELECT FROM(CON) TO(OUT1) ON(1,10,CH) NODUPS
/*
But i am facing other problem now..
I am gettin uncommon records from both the input files and i just want the uncommon records from just one file.
ex:
PS FILE : LREC:58, recfm:FB ,in1
0000000000
7CM ABC411
7CL EFD357
7AC DCB682
7CL BNJ281
7CM MNG282
VSAM 2: Key lenght 10, LREC=58. in2
7CM ABC411
7ww ANU123
7CL BNJ281
output:
PS file:LREC=58, RECFM:FB
0000000000
7ww ANU13 **
7CL EFD357
7AC DCB682
7CM MNG282
** i dont want his record in my output..just the uncommon records from 1st input file.
Regards
Anu
This code worked properly...thanks a lot
//STEP0010 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE)
//CON DD DSN=in1
// DD DSN=in2
//OUT1 DD DSN=out1
//TOOLIN DD *
SELECT FROM(CON) TO(OUT1) ON(1,10,CH) NODUPS
/*
But i am facing other problem now..
I am gettin uncommon records from both the input files and i just want the uncommon records from just one file.
ex:
PS FILE : LREC:58, recfm:FB ,in1
0000000000
7CM ABC411
7CL EFD357
7AC DCB682
7CL BNJ281
7CM MNG282
VSAM 2: Key lenght 10, LREC=58. in2
7CM ABC411
7ww ANU123
7CL BNJ281
output:
PS file:LREC=58, RECFM:FB
0000000000
7ww ANU13 **
7CL EFD357
7AC DCB682
7CM MNG282
** i dont want his record in my output..just the uncommon records from 1st input file.
Regards
Anu
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Huh? I gave you a new DFSORT/ICETOOL job for your new requirement. You are showing the old DFSORT/ICETOOL job for your old requirement. The new job does what you want based on what you described previously. Why are you still using the old job?
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
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