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
 
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: 995
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: 10308
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 Comparing 2 Files using Current time arunsoods DFSORT/ICETOOL 5 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 21 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
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm

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