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
 

 

STRING manipulation to CAPS first char

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

New User


Joined: 28 Jun 2006
Posts: 1
Location: noida

PostPosted: Wed Jun 28, 2006 4:12 pm    Post subject: STRING manipulation to CAPS first char
Reply with quote

Hi,
I need to change one string,
from: micheal learns to rock
to: Micheal Learns To Rock

means every first character should be in Caps.
Constraints:
1- there could be more than one blank between two characters
2-need to place the words exactly on the same location as they were initially

-Anurag Verma
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jun 28, 2006 5:10 pm    Post subject:
Reply with quote

You will have to initiate a loop (PERFORM VARYING), keep the last character, and if it blank, change the current one with UPPER-CASE function.

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

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jun 29, 2006 1:36 pm    Post subject: Re: STRING manipulation
Reply with quote

Hi
Please check the following method.

working-storage section.
01 a pic x(30).
01 j pic 99 value 1.
01 i pic 99 value 0.
01 b pic x value spaces.
01 m.
02 n occurs 30 times.
03 ws-temp pic x.
procedure division.
p1.
ACCEPT A.
perform p2 varying i from 1 by 1 until i > 30.
display m.
stop run.
p2.
move a(i:1) to b.

if a(i:1) = spaces
compute j = i + 1.

if j = i

inspect b converting "abcdefghijklmnopqrstuvwxyz"
to "ABCDEFGHIJKLMNOPQRSTUVWXYZ".

move b to ws-temp(i).


Regards

Aji Cherian
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
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


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