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
 
How to merge two files which have keys in different formats?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
nynali

New User


Joined: 08 May 2007
Posts: 13
Location: Hyderabad

PostPosted: Wed Oct 08, 2008 12:25 pm    Post subject: How to merge two files which have keys in different formats?
Reply with quote

Hi,
I have two files FILE1(key 1 to 6 bytes 9(6) field, LRECL=150) and FILE2 (key 1 to 4 bytes S9(6) Comp-3, LRECL=230).
Now I want write out all the records from FILE2 only if the key field gets a match from FILE1. Please let me know how I can achieve this.

Thanks in Advance !!!
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Wed Oct 08, 2008 1:11 pm    Post subject:
Reply with quote

nynali,

You can do this using any of the sort products(DFSORT or SYNCSORT) if you have any of them installed and the solution differs based on which one you have.
Can you post the sort product info?. Also do you expect duplicate keys in FILE1(or FILE2)?
Back to top
View user's profile Send private message
nynali

New User


Joined: 08 May 2007
Posts: 13
Location: Hyderabad

PostPosted: Wed Oct 08, 2008 2:27 pm    Post subject: Reply to: How to merge two files which have keys in differen
Reply with quote

Arun,
We use SYNCSORT.
FILE2 might have duplicates. FILE1 doesn't have any duplicates
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 08, 2008 5:25 pm    Post subject:
Reply with quote

Hello,

If you have Syncsort for z/OS 1.2 or later you can use Syncsort's JOIN functionality to do this. But before doing that you should make sure that the keys are in the same format. The below Syncsort job does what you asked for.
Code:
//STEP1    EXEC PGM=SORT                           
//SORTIN   DD DSN= Input file1 ------> FB, LRECL=150
//SYSOUT   DD SYSOUT=*                             
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS)               
//SYSIN    DD *                                     
  INREC BUILD=(1,6,ZD,TO=PD,LENGTH=4)               
  SORT FIELDS=COPY                                 
//*                                                 
//STEP2    EXEC PGM=SORT                           
//SORTJNF1 DD DSN=&&TEMP1,DISP=(OLD,PASS)           
//SORTJNF2 DD DSN= Input file2 ------> FB, LRECL=230
//SORTOUT  DD DSN= Output file ------> FB, LRECL=230
//SYSIN    DD *                                     
  JOINKEYS FILE=F1,FIELDS=(1,4,A)                   
  JOINKEYS FILE=F2,FIELDS=(1,4,A)                   
  REFORMAT FIELDS=(F2:1,230)                       
  SORT FIELDS=COPY                                 
//*     
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 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
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

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