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

Join Files on a key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Tue Oct 04, 2011 4:37 pm
Reply with quote

My requirement is as follows -
There are 2 files A & B.

File A contains a unique list of customer numbers.

File B contains customer numbers & some data. There can be multiple records for the same customer number in this file.

Now I have to create an output file containing the data from file B for all those customer numbers which are present in file A.

File A
Code:
***********************
00001
00002
00003
00004
00005
***********************

File B
Code:
***********************
00001 NAME1 ADDRESS1
00002 NAME2 ADDRESS2
00002 NAME2 ADDRESS3
00003 NAME3 ADDRESS3
00004 NAME4 ADDRESS4
00004 NAME4 ADDRESS5
00005 NAME5 ADDRESS5
00006 NAME6 ADDRESS6
00007 NAME6 ADDRESS6
***********************

Output
Code:
***********************
00001 NAME1 ADDRESS1
00002 NAME2 ADDRESS2
00002 NAME2 ADDRESS3
00003 NAME3 ADDRESS3
00004 NAME4 ADDRESS4
00004 NAME4 ADDRESS5
00005 NAME5 ADDRESS5
***********************
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Oct 04, 2011 6:03 pm
Reply with quote

Please use code tags and not attachments or .jpg files. for your sample data. Your sample File A seems to include line numbers which are not seen in Sample File B or Sample output C. Presumably the 5-digit number is the key for joining? What is your RECFM LRECL (and all the usual information that you should have supplied)?

Given the correct information, the solution can easily be found in Smart DFSORT Tricks @

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094

Garry.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 04, 2011 7:01 pm
Reply with quote

after five years You should have learned not to post screenshots
nothing that a plain text cut and paste could not have done
the topic has been editet to delete the images and use plain text
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Oct 04, 2011 10:15 pm
Reply with quote

sd,

You can use a DFSORT job like the following to do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD *
00001
00002
00003
00004
00005
//IN2 DD *
00001 NAME1 ADDRESS1
00002 NAME2 ADDRESS2
00002 NAME2 ADDRESS3
00003 NAME3 ADDRESS3
00004 NAME4 ADDRESS4
00004 NAME4 ADDRESS5
00005 NAME5 ADDRESS5
00006 NAME6 ADDRESS6
00007 NAME6 ADDRESS6
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,5,A),SORTED
  JOINKEYS F2=IN2,FIELDS=(1,5,A),SORTED
  REFORMAT FIELDS=(F2:1,80)
  OPTION COPY
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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
Search our Forums:

Back to Top