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

Writing into two o/p files using joinkeys


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

New User


Joined: 29 Jan 2007
Posts: 33
Location: chennai

PostPosted: Fri Mar 06, 2009 3:06 pm
Reply with quote

Hi,

I want to compare two files with a key and if the key matched then those records have to write into o/p file1 and those do not match have to write into a o/p file2.. Please give me the syntax for Joinkey for the above requirement

Writing into two o/p files using joinkeys
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Mar 06, 2009 5:53 pm
Reply with quote

bamohan,

Here's a sample SyncSort JOIN UNPAIRED application which writes the below outputs. You can adapt this as per your requirement.

MATCH - matching records
NOMATCH1 - non matching records from file1
NOMATCH2 - non matching records from file2
Code:
//STEP1    EXEC PGM=SORT 
//SORTOUT  DD SYSOUT=*   
//SYSOUT   DD SYSOUT=*   
//NOMATCH1 DD SYSOUT=*   
//NOMATCH2 DD SYSOUT=*   
//MATCH    DD SYSOUT=*   
//SORTJNF1 DD *           
F0 A                     
F0 B                     
F0 C                     
F0 D                     
F1 P                     
F1 Q                     
F1 R                     
//SORTJNF2 DD *           
F2 X                                         
F2 Y                                         
F2 Z                                         
F0 A                                         
F0 B                                         
F0 C                                         
F0 D                                         
//SYSIN    DD *                               
  JOINKEYS FILE=F1,FIELDS=(1,4,A)             
  JOINKEYS FILE=F2,FIELDS=(1,4,A)             
  JOIN UNPAIRED                               
  REFORMAT FIELDS=(F1:1,10,F2:1,80),FILL=X'FF'
  SORT FIELDS=COPY                           
  OUTFIL FNAMES=NOMATCH1,                     
         INCLUDE=(11,1,BI,EQ,X'FF'),         
         BUILD=(1,10)                         
  OUTFIL FNAMES=NOMATCH2,                     
         INCLUDE=(1,1,BI,EQ,X'FF'),           
         BUILD=(11,80)                       
  OUTFIL FNAMES=MATCH,SAVE,                   
         BUILD=(11,80)

MATCH
Code:
F0 A
F0 B
F0 C
F0 D

NOMATCH1
Code:
F1 P
F1 Q
F1 R

NOMATCH2
Code:
F2 X
F2 Y
F2 Z
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Fri Mar 06, 2009 8:55 pm
Reply with quote

bamohan wrote:
I want to compare two files with a key and if the key matched then those records have to write into o/p file1 and those do not match have to write into a o/p file2.

Please provide us with the RECFM and LRECL for both input files, along with the position and length of the key fields for each file.

Also, how do you want the output records formatted when there is a match?
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 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
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
Search our Forums:

Back to Top