AS400 Mid Range/Routine for reversing a NAME field

Advertisement


Question
My file has the employee name contained in one field, in this order:
   FIRSTNAMEspaceMIspaceLASTNAME
I need to reverse the name and put it in this order:
   LASTNAME,FIRSTNAMEspaceMI
Do you have a routine that will do this? Or maybe, to split it into 2 fields:
   LASTNAME
   FIRSTNAMEspaceMI
Thanks!

Answer
I could write a routine to reverse the name order for you, but the difficulty here is determining where the first name ends, especially in cases where the first name includes more than one word.  Is there always a middle initial, or is the initial sometimes blank?  

AS400 Mid Range

All Answers


Answers by Expert:


Ask Experts

Volunteer


Concise Systems/Laird Scranton

Expertise

General AS/400, RPG/400, SDA and CL programming questions. AS/400 performance tuning.

Experience


Past/Present clients
CB Sportswear
Coca-Cola of New York
Encore Paper Company
Golub Corporation
HBO Home Video
Imperial Pools
Kaiser Permanente of NE New York
Mallinckrodt Medical
Marigold Foods
Manpower & Associates
National Datacomputers
New York State Easter Seals Society
New York State Food Merchants Association
Pepsi-Cola Allied Bottlers
Petricca Construction
Taconic Telephone Corporation
TOMRA Recycling
Unistress Corporation

©2012 About.com, a part of The New York Times Company. All rights reserved.