View previous topic :: View next topic
|
Author |
Message |
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
Hello,
I am looking for some help to achieve the following. I have two input files in the following format,
File 1 has two fields. Field 1 will be available from position 1-3 (3 characters long) and field 2 will be available from position 4-13 (10 characters long). This file is presorted in ascending order from position 1-13. For example,
AAAXXXXXXXXXX
AAAXXXXXXXXXU
AAAXXXXXXXXXZ
ABCXXXXXXXXXU
ACDXXXXXXXXXU
ACDXXXXXXXXXZ
File 2 with single field 10 characters long and sorted in ascending order. The set of values in File 2 will be a subset of values in field 2 of file 1.For example,
XXXXXXXXXX
XXXXXXXXXU
I would like to create an output from file 1 with field 2 values available in file 2. For example,
AAAXXXXXXXXXX
AAAXXXXXXXXXU
ABCXXXXXXXXXU
ACDXXXXXXXXXU
Any help would be appreciated. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Isn't this just a basic JOINKEYS operation? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Yes, unless the number of records on the second file is relatively small, it is a simple JOINKEYS. Use SORTED,NOSEQCK on the second file, but the first will have to be sorted.
You only need matched records, so no JOIN statement. REFORMAT can be very simple, just F1:1,13. Since you are matching from the entire data on F2, then the data matched to on F1 is obviously already the same. |
|
Back to top |
|
|
|