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

To get substring of a string including spaces


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

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Oct 08, 2009 9:25 am
Reply with quote

Hi

I have a string which is of cretain length with embedded spaces. I have to take the first 11 characters.

Eg. Input - Program Analysis --> output should be - Program Ana

Can u pls suggest how to do this
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Oct 08, 2009 9:34 am
Reply with quote

See reference modification in the Language Reference Manual.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Oct 08, 2009 10:01 am
Reply with quote

Hi

Im very new to this forum.. can u please give me the link of the manual
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Oct 08, 2009 10:04 am
Reply with quote

Click IBM Manuals at the top of the screen.
Back to top
View user's profile Send private message
narasimha.g

New User


Joined: 10 Sep 2009
Posts: 68
Location: Liverpool

PostPosted: Thu Oct 08, 2009 10:12 am
Reply with quote

I used referance modification as shown below.

MOVE WS-STRING (1:11) TO WS-SUB-STRING

where WS-STRING = program mn454

but the o/p was WS-SUB-STRING = MN4

can u pls help me in solving this.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Oct 08, 2009 10:16 am
Reply with quote

In order for us to help, you need to copy/paste the exact field definitions and all relevant code. Add a display statement to show the contents of WS-SUB-STRING after the MOVE.
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
Search our Forums:

Back to Top