Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to compare 2 fields in 2 files before joining them

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed May 02, 2007 11:52 pm    Post subject: Need to compare 2 fields in 2 files before joining them
Reply with quote

Need to compare 2 fields in 2 files before joining them

Key positions :
Key1 : file1 : 7th col, 3 char to be compared with file2 : 7th col, 3 char
Key2 : file1 : 14th col, 5 char to be compared with file2 : 1st col, 5 char
File1 format
Code:

     |014|CI|PL001|                    |002|

File2 format
Code:

PL001;014;NORTH COAST HOUSE

Output format
Code:

     |014|CI|PL001|NORTH COAST HOUSE   |002|
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 03, 2007 1:08 am    Post subject:
Reply with quote

What is the RECFM and LRECL of each input file?

If the keys in file1 and file2 don't match, do you want to omit those records from the output file?

Can there be duplicate keys within input file1?

Can there be duplicate keys within input file2?

Please show an example with more than one record in each input file that covers all of the possible variations, and the expected output records.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu May 03, 2007 11:27 am    Post subject: Re: Need to compare 2 fields in 2 files before joining them
Reply with quote

Hi Frank

Lrecl for file1 is 53
Lrecl for file2 is 155

With the key combination of two fields, there can be duplicates in file1, but none in file2
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu May 03, 2007 11:49 am    Post subject:
Reply with quote

Frank..
Forgot to mention - there will definitely be records in file2 with the combination key for all recods in file1

File1

Code:

     |620|KS|DC001|                    |002|HULLO| 
AC210|021|IN|DC002|                    |002|HOLLA| 
AD210|021|IN|DC004|                    |002|HOLLA| 


File2:

Code:

DC001;620;COL.WHSE.BKY.STORG. ;1299 ALUM CREEK DR.     
DC002;021;COLS.COOKIE WHSE STR;2880 WILLIAMS DR.       
DC004;021;COLS. BAKERY STORES ;1100 PORT DR.           


Output
Code:

AC210|620|KS|DC001|COLS.WHSE.BKY.STORG. |002|HULLO|
AC210|021|IN|DC002|COLS.COOKIE WHSE STR |002|HULLO|
AD210|021|IN|DC004|COLS.CAKE STORAGE    |002|HOLLA|
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu May 03, 2007 11:53 am    Post subject:
Reply with quote

Sorry Frank..

the output file is supposed to be

Code:

     |620|KS|DC001|COLS.WHSE.BKY.STORG. |002|HULLO|
AC210|021|IN|DC002|COLS.COOKIE WHSE STR |002|HULLO|
AD210|021|IN|DC004|COLS.CAKE STORAGE    |002|HOLLA|
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 03, 2007 10:54 pm    Post subject:
Reply with quote

I believe your DC004 record should have COLS. BAKERY STORES.

At any rate, here's a DFSORT/ICETOOL job that will do what you asked for. The output records will be in key1/key2 order. If you want them in a different order, you can do another SORT.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN2 DD DSN=...  input file2 (FB/155)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=...  input file1 (FB/53)
//OUT DD DSN=...  output file (FB/53)
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(7,3,CH) ON(14,5,CH) -
 WITHALL WITH(1,19) WITH(40,14)
/*
//CTL1CNTL DD *
  INREC BUILD=(7:7,3,14:1,5,20:11,20,53:X)
/*
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon May 07, 2007 9:34 pm    Post subject: thnx
Reply with quote

Thanks frank,
Your suggestion is working fine.
Back to top
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Wed May 09, 2007 11:04 am    Post subject: Thank you so much
Reply with quote

I used the above forum for my work...
And its working perfect....Thanks once again for the Author and Moderator...Thanks icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us