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

Joinkeys function for matching logic


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kumar9930

New User


Joined: 16 Jul 2008
Posts: 2
Location: india

PostPosted: Fri Jul 18, 2008 5:32 pm
Reply with quote

Hi,

I have a requirement where i need to compare records in 1 file with records in other file(2nd file). If match found records from 2nd file should be written to New file(3rd file) with the same sequence as in 2nd file.

I applied Join keys function to match files it is working fine but it is not following the sequence correctly. Can any one advise me on this to get Correct SEQUENCE as in the 2nd file to new file.

Thanks in advance
Kumar.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Fri Jul 18, 2008 5:35 pm
Reply with quote

could you post an example of what's happening?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jul 18, 2008 5:37 pm
Reply with quote

Kumar,

Can you give some sample input and output records.......

Thanks,
Arun
Back to top
View user's profile Send private message
Prasanthhere

Active User


Joined: 03 Aug 2005
Posts: 306

PostPosted: Fri Jul 18, 2008 5:40 pm
Reply with quote

Whats the LRECL RECFM and Key length of file1 and file2
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Jul 18, 2008 8:36 pm
Reply with quote

kumar9930 wrote:
Can any one advise me on this to get Correct SEQUENCE as in the 2nd file to new file.
Code a SORT statement after your JOINKEYS and/or REFORMAT statements to include the desired sort order.
Code:
SORT FIELDS=(p,l,f,o...)

(Without seeing your JCL or sample data, there is not much more information we can provide you with).
Back to top
View user's profile Send private message
kumar9930

New User


Joined: 16 Jul 2008
Posts: 2
Location: india

PostPosted: Fri Jul 18, 2008 10:40 pm
Reply with quote

Hi,

Here i am giving an example.

File 1:
12345
22222
33333

File 2:
22222 matching
22222 records
12345 sort
12345 order
12345 sequence
33333 syncsort
33333 joinkeys
33333 function

i am expecting the same Output in File3 as it is in File2. Sequence must be same.

Output i am getting in File3 differs some times as shown.

File3:
12345 order
12345 sort
12345 sequence
22222 records
22222 matching
33333 syncsort
33333 joinkeys
33333 function

Kumar.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Jul 18, 2008 11:07 pm
Reply with quote

Off-hand, I know this can be done in 2 steps:
Code:
//STEP1 EXEC PGM=SORT 
//SORTIN DD *         
22222 MATCHING         
22222 RECORDS         
12345 SORT             
12345 ORDER           
12345 SEQUENCE         
33333 SYNCSORT         
33333 JOINKEYS         
33333 FUNCTION   
//SORTOUT DD DSN=&&TEMP,DISP=(NEW,PASS)           
//SYSOUT DD SYSOUT=*                               
//SYSIN DD *                                       
  SORT FIELDS=COPY                                 
  OUTREC BUILD=(1,15,16:SEQNUM,4,ZD)               
//SORT2 EXEC PGM=SORT                             
//SORTJNF1 DD DSN=&&TEMP,DISP=(OLD,DELETE)         
//SORTJNF2 DD *                                   
12345                                             
22222                                             
33333                                             
//SORTOUT DD SYSOUT=*                             
//SYSOUT DD SYSOUT=*                               
//SYSIN    DD    *                                 
  JOINKEYS FILES=F1,FIELDS=(1,5,A)                 
  JOINKEYS FILES=F2,FIELDS=(1,5,A)                 
  REFORMAT FIELDS=(F1:1,19)       
  SORT FIELDS=(16,4,CH,A) 
  OUTREC FIELDS=(1,15)               
/*

I'll have to see if I can get this down to a single pass of the data.
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 Calling an Open C library function in... CICS 1
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts DATE2 function SYNCSORT 15
Search our Forums:

Back to Top