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
 

 

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: 2276
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


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