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
 

 

Joinkeys function for matching logic

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Joinkeys function for matching logic
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    Post subject:
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: 2181
Location: @my desk

PostPosted: Fri Jul 18, 2008 5:37 pm    Post subject:
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    Post subject: Reply to: Joinkeys function for matching logic
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: 500
Location: USA

PostPosted: Fri Jul 18, 2008 8:36 pm    Post subject: Re: Joinkeys function for matching logic
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    Post subject:
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: 500
Location: USA

PostPosted: Fri Jul 18, 2008 11:07 pm    Post subject:
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    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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm


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