Posted: Fri Apr 11, 2008 3:58 pm Post subject: Parse and Replace Characters
Greetings,
I am working on a file that has a last name field on positions 1 to 20 and a name suffix field on positions 21 to 24. The last name field may or may not contain suffixes such as JR, SR, II, III, etc. If the suffixes are present in the last name field, the suffix field itself is blank. In order to standardize the name fields, I would like to do the following:
Convert the value of the name suffix field as follows:
JR to J
SR to S
II to 2
III to 3
Search for the string of JR, SR, II, III, etc on the last name field. If those values are found, remove them from the last name field, convert the suffixes, and move them to the name suffix field. The values will be converted as follows:
JR to J
SR to S
II to 2
III to 3....
The input file has the following names:
Code:
----+----1----+----2----+
MOXLE SR
MOXLE SR
DE LA PAZ JR
DE LA PAZ II
I would like the output to appear as follows:
Code:
----+----1----+----2----+
MOXLE S
MOXLE S
DE LA PAZ J
DE LA PAZ 2
Can I do the above with DFSORT/ICETOOL, or should I code a program instead?
_________________ 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
Very ingenious solution, Frank. I see how you treated the two fields as one, and used the substring function to look for the suffixes. You are certainly not only the guru, but also very creative with the functions.
Thank you for your help. This will help me streamline and speed up my process as this file has about 80 million records.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum