I have a name variable with any characters (for eg mr. subhash agarwal, mRs. sheila STAGE. etc.). I have to convert this string so that it shows correct format ( eg. Mr. Subhash Agarwal, Mrs. Sheila Stage.
please suggest the "inspect syntax" for this, also if there's an alternative.
Really need more information about your name fields
are the ONLY possibilities Mr and Mrs?
is there always a period after the Mr/Mrs?
does the Forename always start in the same position?
does the Surname always start in the same position
Is it possible that there are middle names, double names
anything else that you are not telling us?
I think I would use a combination of INSPECT and UNSTRING
along the following lines
first convert all of your name field to lower case
Next split your field into three, I am assuming that there is always a space between title and firstname and firstname and surname and that there are no middle names.
thus set up three fileds to hold the data eg
03 TITLE1 Pic x
03 TITLEX Pic x(3)
FIRSTNAME (same as TITLE but you determine size)
SURNAME (same as TITLE but you determine size)
UNSTRING NAME-FIELD DELIMITED BY ALL SPACES INTO
now you have three fields all lower case so all you need to do now is set the first character in each to upper case eg