Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Writing into two o/p files using joinkeys

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Writing into two o/p files using joinkeys
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: 2285
Location: @my desk

PostPosted: Fri Mar 06, 2009 5:53 pm    Post subject:
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: 500
Location: USA

PostPosted: Fri Mar 06, 2009 8:55 pm    Post subject: Re: Writing into two o/p files using joinkeys
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    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 Weirdo results with JOINKEYS Balaryan DFSORT/ICETOOL 4 Wed Oct 18, 2017 9:04 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us