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
 

 

Join Files on a key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Join Files on a key
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

Active Member


Joined: 08 May 2006
Posts: 992
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Oct 04, 2011 6:03 pm    Post subject:
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 @

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

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10234
Location: italy

PostPosted: Tue Oct 04, 2011 7:01 pm    Post subject: Reply to: Join Files on a key
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 Moderator


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

PostPosted: Tue Oct 04, 2011 10:15 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm


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