View previous topic :: View next topic |
Author |
Message |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Fri Dec 05, 2008 12:11 pm Post subject: Looking up multiple files using SORT |
|
|
Hi,
Is it possible to do multiple file look up using SORT? File01 has some records and these should be searched in 4 other files and if found should be written to four different output files - using SORT.
Please suggest.
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Fri Dec 05, 2008 1:47 pm Post subject: |
|
|
Please show an example of the records in each input file and what you want for output. Give the RECFM and LRECL of the input files. Give the starting position, length and format of all relevant fields. If there can be duplicates within any of the input files, show that in the example. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
amargulies Beginner
Joined: 10 Jan 2007 Posts: 123 Topics: 0
|
Posted: Mon Dec 08, 2008 2:52 pm Post subject: |
|
|
Also, is there a field in each record to identify which file the record is from? _________________ Alissa Margulies
SyncSort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Tue Dec 09, 2008 8:57 am Post subject: Data |
|
|
All the files are LRECL=80 and RECFM=FB. Duplicates are certainly possible. The look up should happen based on 1st column with a length of 3 and 20th column with a length of 6. All the matching records should be written to respective output files else an empty file.
This is how data appears......
File01:
Code: |
---------1---------2---------3---------4---------5---------6---------7---------8
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Data in File02:
Code: |
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Data in File03:
Code: |
T0N XMDT0N 73 CHRI35 2039 TS1
FJQ TCDFJQ 73 MAJORS 2039 TS2
F0X XMDF0X 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Data in File04:
Code: |
FJQ TCDFJQ 73 MAJORS 2039 TS2
F0X XMDF0X 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Data in File05:
Code: |
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Dec 09, 2008 11:41 am Post subject: |
|
|
ranga_subham,
Does file 1 contains duplicates ? Do you expect FILE 1 to be huge? It is just a look up file how many records does it have now? what is the expected output ?
Kolusu |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Wed Dec 10, 2008 1:14 am Post subject: |
|
|
Kolusu, the File01 possibly will have 1000 records which are put by end-user. It cannot have duplicates. Each individual output file should have all those matching records (including duplicates too) from File01.
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Thu Dec 11, 2008 6:23 am Post subject: Required Output: |
|
|
The expected output should be this.....
Output-File02:
Code: |
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Output-File03:
Code: |
T0N XMDT0N 73 CHRI35 2039 TS1
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Output-File04:
Code: |
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Output-File05:
Code: |
TJQ TCDTJQ 73 MAJORS 2039 TS2
|
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
samlwho Beginner
Joined: 08 Feb 2007 Posts: 21 Topics: 2
|
Posted: Fri Dec 12, 2008 2:56 pm Post subject: |
|
|
If I understand your dilemma correctly, the SYNCSORT JOIN below will produce what you desire. In the example below, the F1 is File01 and F2 is DataFile02.
Syncsort Parameters :
JOINKEYS = Matching position 1,3 and 20,6 is the same as matching on 1,25. As such, the key for both files are positions 1,25.
JOIN UNPAIRED = Results in Syncsort writing an output file that contains records with matching keys as well as unmatched records from both files.
REFORMAT FIELDS = Defines the output file. Here, the total record is written from both files. By doing this the Include verb can be used to create three different files.
1. Records that match
2. Records that are on F1 only
3. Records that are on F2 only
Note: The step below would need to be replicated four times for each input file and each step will result in listed output files.
I hope this helps |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Mon Dec 15, 2008 4:39 am Post subject: |
|
|
I will try it and let you know.
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
ranga_subham Intermediate

Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Mon Dec 15, 2008 8:55 am Post subject: |
|
|
SAMLWHO, what will happen to File03, File04 & File05 ? Where are they referred?
Thanks. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
 |
|
|