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

Need a program to reverse the string from a Sentence


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Wed May 11, 2005 12:06 pm
Reply with quote

Hi,

I have a array of strings form a Sentence.Need a program to reverse the words.
Back to top
View user's profile Send private message
vasanthanc

New User


Joined: 01 Apr 2005
Posts: 58

PostPosted: Wed May 11, 2005 12:47 pm
Reply with quote

You can use the REVERSE key word to reverse characters in a word. To reverse the whole sentence also you can use the same. But if you want to keep the words as whole, then you can use the following code

for i = 1 to no-of-words
move old-sentance(n - i + 1) to new-sentance(i)
end-for

where as old-sentance and new-sentance are arrays, in which each array elament have single word and no-of-words have the total no of words in the sentance

Hope this will help you
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 Using API Gateway from CICS program CICS 0
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts DB2 Event passed to the Application P... DB2 1
Search our Forums:

Back to Top