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
 

 

Compare files using JOIN Keys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
selvamphigai

New User


Joined: 22 Jan 2010
Posts: 11
Location: chennai

PostPosted: Thu Feb 25, 2010 3:19 pm    Post subject: Compare files using JOIN Keys
Reply with quote

I have 2 files ,file1 & file2 .I need to compare these 2 files for the matched records . from the matched records I need to filter based on a 1 byte indicator.

here is the code i tried ,
Code:
JOINKEYS FILES=F1,FIELDS=(5,9,A)                                     
JOINKEYS FILES=F2,FIELDS=(19,9,A)                                   
JOIN UNPAIRED,F1                                             
REFORMAT FIELDS=(F1:1,814)                                           
SORT FIELDS=COPY                                                     
OUTFIL FNAMES=MATCHIRA,INCLUDE=(42,1,CH,EQ,C'1',                     
                                   OR,42,1,CH,EQ,C'2'),BUILD=(1,814)

also for syntax UNPAIRED ,i know that I ll get the records that are in file1 and not in file2 . i tried for JOIN PAIRED to get matched records.but its not working,can some one help me ?

Edited: Please use BBcode when You post some code/error, that's rather readable, Thanks... Anuj
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Feb 25, 2010 3:26 pm    Post subject:
Reply with quote

Are you sing DFSort or SyncSort? And when you say it's not working - what actually happened?

PS. Also, please learn using BBCode.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 25, 2010 3:39 pm    Post subject:
Reply with quote

Showing the output of the failed run would be far more productive.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2181
Location: @my desk

PostPosted: Thu Feb 25, 2010 4:33 pm    Post subject:
Reply with quote

Quote:
also for syntax UNPAIRED ,i know that I ll get the records that are in file1 and not in file2 . i tried for JOIN PAIRED to get matched records.but its not working,can some one help me ?
For matched records alone, you dont need the JOIN statement. You can omit the JOIN statement itself if you want ONLY matched records.
Back to top
View user's profile Send private message
selvamphigai

New User


Joined: 22 Jan 2010
Posts: 11
Location: chennai

PostPosted: Thu Feb 25, 2010 5:50 pm    Post subject:
Reply with quote

Thanks Arun & Anuj ,,code is working now...

here is the one i tried,,
Code:

JOINKEYS FILES=F1,FIELDS=(19,9,A)
JOINKEYS FILES=F2,FIELDS=(5,9,A)
REFORMAT FIELDS=(F2:1,303)       
SORT FIELDS=COPY   

Before this join step in proc ,i cretaed an another step which extracted the records(file F1) based on an indicator & i used that file F1 and matched it with F2 ...to get the matched records ...
Thank you Guys,,,

But still ,instead of doing this separately in each step,,can i do it in single SORT,,? icon_wink.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2181
Location: @my desk

PostPosted: Fri Feb 26, 2010 1:24 am    Post subject:
Reply with quote

selvamphigai wrote:
But still ,instead of doing this separately in each step,,can i do it in single SORT,,? icon_wink.gif
Yes if I understood this correctly. Modify your sort card as the below one (Untested). From your latest post, you need to filter F1 records based on some indicator and the below sort extracts records having '1' or '2' at 42-pos from F1 before doing a match.Do try this and let us know the results.
Code:
JOINKEYS FILES=F1,FIELDS=(19,9,A),
         INCLUDE=(42,1,SS,EQ,C'1,2') 
JOINKEYS FILES=F2,FIELDS=(5,9,A)                 
REFORMAT FIELDS=(F2:1,303)       
SORT FIELDS=COPY
Back to top
View user's profile Send private message
selvamphigai

New User


Joined: 22 Jan 2010
Posts: 11
Location: chennai

PostPosted: Fri Feb 26, 2010 12:09 pm    Post subject:
Reply with quote

Arun , code u hav given is working .Thanks.In the include card you hav specifies as 'SS".Can you explain what it is ?

Here is the code ,

Code:
//R030     EXEC  PGM=SORT                                             
//SORTJNF1 DD  DSN=TSOSNAG.WDHT.UNLOAD,                               
//             DISP=SHR                                               
//SORTJNF2 DD  DSN=TSOSNAG.PFLT.UNLOAD,                               
//             DISP=SHR                                               
//SORTOUT  DD  DSN=TSOSNAG.TEST.IRAPFLT,                               
//             DISP=(NEW,CATLG,DELETE),                               
//             UNIT=SYSDA,                                             
//             AVGREC=K,                                               
//             STORCLAS=CTSDASD,                                       
//             SPACE=(814,(1500,1500),RLSE),                           
//             DCB=(RECFM=FB,LRECL=814)                               
//SYSIN    DD  *                                                       
   JOINKEYS FILES=F1,FIELDS=(19,9,A),SORTED,INCLUDE=(42,1,SS,EQ,C'1,2')
   JOINKEYS FILES=F2,FIELDS=(5,9,A),SORTED                             
   REFORMAT FIELDS=(F2:1,303)                                         
   SORT FIELDS=COPY         


so,from the WDHT file ,it will take the records which have IRA code as 1 or 2 & those extracted records will be compared with the second PFLT file for the matched accts.is that right ?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Feb 26, 2010 4:17 pm    Post subject:
Reply with quote

selvamphigai wrote:
you hav specifies as 'SS".Can you explain what it is ?
SS stands for Substring - SyncSort for z/OS Programmer's Guide Release 1.3 Page 2.42 lists the detals about SS. There is a reference to SS on some other pages, too.

Quote:
so,from the WDHT file ,it will take the records which have IRA code as 1 or 2 & those extracted records will be compared with the second PFLT file for the matched accts.is that right ?
If what at position 42 of length "1" is called IRA-code (which is someting specific to your environment/files) - then your understanding is correct.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
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 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 How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm


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