I want to be able to compare two files(file A and file B) and write the unique (non-matching) records from file A to an output file (file C) and duplicate records to another file (file D). File D needs to be in a report format. There also has be be another file (File E) that is a exact copy of File B. I know that ICETOOL can do something like this but not sure of the syntax
input:
File A:
AAA1111
BBB2222
CCC333
DDD444
File B:
AAA111
BBB222
EEE555
FFF666
GGG777
OUTPUT FILES:
FILE C:
CCC333
DDD444
File D: Report file (133 bytes long)
I need a header that will print at the top of every page
layout like this: this will be 133 bytes long
company: xxxx page: xxx
Application: xxx date: xx/xx/xx
JOB: xxxx
REPORT: Dropped records due to customer code mismatch
AAA111 (detail records)
BBB222
File E:
AAA111
BBB222
EEE555
FFF666
GGG777
compare two files and write duplicate records to file no dup
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 4
- Joined: Sat Dec 09, 2006 7:22 am
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your "key" was in positions 1-6, and your input files have RECFM=FB and LRECL=80. You can change the job appropriately if those assumptions are incorrect.
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=... input fileA (FB/80)
//FILEB DD DSN=... input fileB (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=... output fileC (FB/80)
//FILED DD DSN=... output fileD (FBA/133)
//FILEE DD DSN=... output fileE (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(FILEC) ON(1,6,CH) NODUPS -
DISCARD(FILED) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'A')
/*
//CTL2CNTL DD *
INREC OVERLAY=(81:C'B')
OUTFIL FNAMES=T1
OUTFIL FNAMES=FILEE,BUILD=(1,80)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(81,1,CH,EQ,C'A'),
BUILD=(1,80)
OUTFIL FNAMES=FILED,INCLUDE=(81,1,CH,EQ,C'A'),
HEADER2=(8:'company: xxxx',76:'page: ',PAGE=(M11,LENGTH=3),/,
8:'Application: xxxx',78:'date: ',DATE,/,
8:'JOB: xxxx',/,
8:'REPORT: Dropped records due to customer code mismatch',
X,/,X),
BUILD=(1,80,132:X)
/*
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
-
- Member
- Posts: 4
- Joined: Sat Dec 09, 2006 7:22 am
icetool quesitons
Frank,
My input files are:
File A: RECFM=FB and LRECL=150
File B: RECFM=FB and LRECL=13
The key field is 13 bytes long. This is what I will use to match records from the two files
output file:
File C: RECFM=FB and LRECL=150
File D: RECFM=FB and LRECL=150 - Report
File E: RECFM=FB and LRECL=13
Is it possbile to sort these two input files(File A and File B) using ICETOOL and then do the processing?
My input files are:
File A: RECFM=FB and LRECL=150
File B: RECFM=FB and LRECL=13
The key field is 13 bytes long. This is what I will use to match records from the two files
output file:
File C: RECFM=FB and LRECL=150
File D: RECFM=FB and LRECL=150 - Report
File E: RECFM=FB and LRECL=13
Is it possbile to sort these two input files(File A and File B) using ICETOOL and then do the processing?
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
We just need to change the DFSORT/ICETOOL job a little to handle files with those attributes and the 13-byte key as follows:
Code: Select all
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=... input fileA (FB/150)
//FILEB DD DSN=... input fileB (FB/13)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=... output fileC (FB/150)
//FILED DD DSN=... output fileD (FB/150)
//FILEE DD DSN=... output fileE (FB/13)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(FILEC) ON(1,13,CH) NODUPS -
DISCARD(FILED) USING(CTL3)
/*
//CTL1CNTL DD *
INREC OVERLAY=(151:C'A')
/*
//CTL2CNTL DD *
INREC OVERLAY=(151:C'B')
OUTFIL FNAMES=T1
OUTFIL FNAMES=FILEE,BUILD=(1,13)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=FILEC,INCLUDE=(151,1,CH,EQ,C'A'),
BUILD=(1,150)
OUTFIL FNAMES=FILED,REMOVECC,INCLUDE=(151,1,CH,EQ,C'A'),
HEADER2=(8:'company: xxxx',76:'page: ',PAGE=(M11,LENGTH=3),/,
8:'Application: xxxx',78:'date: ',DATE,/,
8:'JOB: xxxx',/,
8:'REPORT: Dropped records due to customer code mismatch',
X,/,X),
BUILD=(1,150)
/*
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