IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare files using JOIN Keys


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Superior Member


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

PostPosted: Thu Feb 25, 2010 3:26 pm
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: 8797
Location: Welsh Wales

PostPosted: Thu Feb 25, 2010 3:39 pm
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: 2481
Location: @my desk

PostPosted: Thu Feb 25, 2010 4:33 pm
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
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: 2481
Location: @my desk

PostPosted: Fri Feb 26, 2010 1:24 am
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
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

Superior Member


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

PostPosted: Fri Feb 26, 2010 4:17 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top