IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

STRING manipulation to CAPS first char


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Wed Jun 28, 2006 5:10 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
Search our Forums:

Back to Top