Hi
I have three files. I need to compare infile1 with infile2 write into outfile1 and compare infile1 again with infile3 write into outfile2. Can I do it using JOINKEYS and ICETOOL ? If yes, please let me know how.
infile1
====
65109 data1 data2 data3
65110 data4 data5 data6
65111 data7 data8 data9
65201 1data 2data 3data
65202 4data 5data 6data
65203 7data 8data 9data
infile2
====
65109
65110
65111
infile3
====
65201
65202
65203
outfile1 should be
============
65109 data1 data2 data3
65110 data4 data5 data6
65111 data7 data8 data9
outfile2 should be
============
65201 1data 2data 3data
65202 4data 5data 6data
65203 7data 8data 9data
Key to compare with infile1 is first 5 digit bytes of code in infile2 and infile3.
Thanks in Advance
dxg1739
Joinkeys using ICETOOL
Moderators: Frank Yaeger, Moderator Group
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Which particular ICETOOL function do you fancy using? Unless you have one in mind, and a reason for it, you can easily stick to plain Sort.
I would, assuming there is no trailer on infile2, make one, concatenate infile2, dummy trailer, infile3, include a byte to indicate the source of the infile2/3, use JOINKEYS, use OUTFIL to direct the output to one file dependent on added byte and use SAVE on the other.
I would, assuming there is no trailer on infile2, make one, concatenate infile2, dummy trailer, infile3, include a byte to indicate the source of the infile2/3, use JOINKEYS, use OUTFIL to direct the output to one file dependent on added byte and use SAVE on the other.
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Firstly, forget ICETOOL for now. What you want is SORT.
The thing you want in SORT is JOINKEYS.
JOINKEYS matches two input files.
You have a data file and two "key" files.
If you concatenate the "key" files, you only have one JOINKEYS process to run.
If you have a trailer on (at least) your first input file, you will be able to put "a value" as an extension on data from the first "key" file, and "another value" in the same place on the record for data from the second "key" file.
You then do the JOINKEYS as normal. In a COPY operation after the JOINKEYS (still part of the same thing) you can use two OUTFIL statements, which output data to output 1 or output 2 depending on the value of the position populated by "a value"/"another value".
So, find some examples of JOINKEYS. Read in the manual on JOINKEYS. Do some experiments. If you have problems, let us know, with full information. If you get it to work, let us know, with the control cards, as it may help someone with a similar requirement in the future.
The thing you want in SORT is JOINKEYS.
JOINKEYS matches two input files.
You have a data file and two "key" files.
If you concatenate the "key" files, you only have one JOINKEYS process to run.
If you have a trailer on (at least) your first input file, you will be able to put "a value" as an extension on data from the first "key" file, and "another value" in the same place on the record for data from the second "key" file.
You then do the JOINKEYS as normal. In a COPY operation after the JOINKEYS (still part of the same thing) you can use two OUTFIL statements, which output data to output 1 or output 2 depending on the value of the position populated by "a value"/"another value".
So, find some examples of JOINKEYS. Read in the manual on JOINKEYS. Do some experiments. If you have problems, let us know, with full information. If you get it to work, let us know, with the control cards, as it may help someone with a similar requirement in the future.
-
- Member
- Posts: 1
- Joined: Wed Apr 17, 2013 7:11 pm
- Location: UK
This will also give you the required results
//TOOLIN DD *
COPY JKFROM TO(X1) USING(CTL1)
COPY JKFROM TO(X2) USING(CTL2)
//CTL1CNTL DD * *
JOINKEYS F1=IN1,FIELDS=(1,4,A)
JOINKEYS F2=IN2,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,80)
//CTL2CNTL DD * *
JOINKEYS F1=IN1,FIELDS=(1,4,A)
JOINKEYS F2=IN3,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,80)
//
note
IN1
IN2
IN3
are the 3 input files
X1
X2
are the 2 output files
COPY JKFROM TO(X1) USING(CTL1)
COPY JKFROM TO(X2) USING(CTL2)
//CTL1CNTL DD * *
JOINKEYS F1=IN1,FIELDS=(1,4,A)
JOINKEYS F2=IN2,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,80)
//CTL2CNTL DD * *
JOINKEYS F1=IN1,FIELDS=(1,4,A)
JOINKEYS F2=IN3,FIELDS=(1,4,A)
REFORMAT FIELDS=(F1:1,80)
//
note
IN1
IN2
IN3
are the 3 input files
X1
X2
are the 2 output files
Monkeys & Money ! I'd rather devolve
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