compare two files using SORT

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
anu.slaksh
Member
Posts: 11
Joined: Tue Nov 13, 2007 1:57 pm

compare two files using SORT

Post by anu.slaksh » Tue Nov 13, 2007 2:19 pm

i need to compare two files using SORT.

Here is my requirement:
I have two input files
input 1: length 850
input 2: length 200

I need to compare the (9,9,ch) of both the files. this 9,9 indicates the account number starting from 9th position with length 9. For those accounts that has a match in the input file,the (114,3,ch) data has to be fetched from the input 2.
That is there is a label for each account in input 2. i need to fetch those labels for every match in account in both the files.
Regarding duplicates, there will be duplicates in both the files.
i want to ignore the duplicates.

How can this be done using a sort?? I cant use ICETOOL. Can my
requirements be done using SORT CARD??
anu

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Nov 13, 2007 8:51 pm

How can this be done using a sort?? I cant use ICETOOL. Can my
requirements be done using SORT CARD??
Why can't you use ICETOOL? If you can use DFSORT, you can use ICETOOL. ICETOOL has been available with DFSORT since 1991.

Please show an example of the records in each input file (relevant fields only) and what you expect for output.
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

anu.slaksh
Member
Posts: 11
Joined: Tue Nov 13, 2007 1:57 pm

Post by anu.slaksh » Wed Nov 14, 2007 9:28 am

input 1:

colu 9
-------
111111111
111111111
222222222
333333333

INPUT2:

COL 9 COL144
----------- ----------


111111111 ABC
222222222 ABN
222222222 ABN
333333333 EGL

Output:
---------

ABC 111111111
ABN 222222222
EGL 333333333

Here is my sample input and output..
am fine with ICETOOL also..
anu

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Nov 14, 2007 9:03 pm

You can use a DFSORT/ICETOOL job like the following to do what you asked for.

Note: You said 114,3,CH in your first post, but showed COL144 in your last post. I assumed it's 144 - if it's 114, just change the job appropriately.

Code: Select all

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/850)
//IN2 DD DSN=...  input file2 (FB/200)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/13)
//TOOLIN DD *
SELECT FROM(IN2) TO(T1) ON(5,9,CH) FIRST USING(CTL2)
SELECT FROM(IN1) TO(T1) ON(5,9,CH) FIRST USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(5,9,CH) FIRSTDUP
/*
//CTL1CNTL DD *
  INREC BUILD=(5:9,9)
/*
//CTL2CNTL DD *
  INREC BUILD=(1:144,3,5:9,9)
/*
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

anu.slaksh
Member
Posts: 11
Joined: Tue Nov 13, 2007 1:57 pm

Post by anu.slaksh » Thu Nov 15, 2007 9:06 am

its working perfectly..
thnks... :D
anu

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 11:06 pm

<< 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