Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Replacing Characters in a string by lower or upper case

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
hernikiten

New User


Joined: 08 Apr 2005
Posts: 23
Location: india

PostPosted: Thu Jun 08, 2006 12:38 pm    Post subject: Replacing Characters in a string by lower or upper case
Reply with quote

Hi,
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.

Thanks.
Back to top
View user's profile Send private message

IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Thu Jun 08, 2006 2:45 pm    Post subject: Re: Replacing Characters in a string by lower or upper case
Reply with quote

Really need more information about your name fields
ie
field size
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?
Back to top
View user's profile Send private message
hernikiten

New User


Joined: 08 Apr 2005
Posts: 23
Location: india

PostPosted: Thu Jun 08, 2006 2:52 pm    Post subject: Re: Replacing Characters in a string by lower or upper case
Reply with quote

Good day IQ,

The positions might change depending upon length of first and middle name. Mr. and Mrs. are the only possibilities.

Thanks
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Fri Jun 09, 2006 4:34 pm    Post subject: Re: Replacing Characters in a string by lower or upper case
Reply with quote

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
ie

INSPECT NAME-FIELD
CONVERTING
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' TO
'abcdefghijklmnopqrstuvwxyz'

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
01 TITLE.
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)
so
UNSTRING NAME-FIELD DELIMITED BY ALL SPACES INTO
TITLE
FIRSTNAME
SURNAME

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

Move 'M' to TITLE1

INSPECT FIRSTNAME1
CONVERTING
”abcdefghijklmnopqrstuvwxyz “TO
”ABCDEFGHIJKLMNOPQRSTUVWXYZ “

INSPECT SURNAME1
CONVERTING
”abcdefghijklmnopqrstuvwxyz “TO
”ABCDEFGHIJKLMNOPQRSTUVWXYZ “


then you might want to STRING or MOVE the data back into the original format but I will leave that to you
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us