View previous topic :: View next topic
|
Author |
Message |
shanudarling Warnings : 1 New User
Joined: 20 Dec 2006 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|