Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us