Joinkeys using ICETOOL

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
dxg1739
Member
Posts: 2
Joined: Thu Feb 21, 2013 8:23 am

Joinkeys using ICETOOL

Post by dxg1739 » Thu Feb 21, 2013 8:30 am

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

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Thu Feb 21, 2013 12:17 pm

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.

dxg1739
Member
Posts: 2
Joined: Thu Feb 21, 2013 8:23 am

Post by dxg1739 » Thu Feb 21, 2013 7:45 pm

Thanks for your input!

I have not used ICETOOL extensively so any function which can make it work will do.

There is one byte of trailer indicator in infile2 and infile3. Can you please be more specific on what you explained below?

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Fri Feb 22, 2013 5:26 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 Last Gunslinger
Member
Posts: 1
Joined: Wed Apr 17, 2013 7:11 pm
Location: UK

This will also give you the required results

Post by The Last Gunslinger » Wed Apr 17, 2013 7:16 pm

//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
Monkeys & Money ! I'd rather devolve

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Feb 01, 2016 1:35 am

<< Content deleted By Admin >>

Post Reply

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



Other References
Mainframe Tools and others