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

ending position of the string


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aravind Kumar. S

New User


Joined: 28 Apr 2005
Posts: 26

PostPosted: Mon Jul 04, 2005 12:02 pm
Reply with quote

hi,

How to find the ending position of the string?


DISPLAY FUNCTION LENGTH(WS-UTLXW-OUT-VARIABLE). Is this correct for finding the length of the variable ?
if not plz. correct me.

Thanks,
Aravind
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 1:21 pm
Reply with quote

Quote:
How to find the ending position of the string?


Need to Define "what is string " first....I mean to say, Is your string ending on a single space or double....means your string having spaces in between or not.

Ex. "I am a Boy" this string having spaces, so total length = 10.

For achieving this....
Quote:
INSPECT IN-STR TALLYING I FOR CHARACTERS BEFORE ' '.


It'll give tiotal length in a counter I.

If your string dont have any spaces in between. give only a single space in place of double in code line above.

Quote:
DISPLAY FUNCTION LENGTH(WS-UTLXW-OUT-VARIABLE). Is this correct for finding the length of the variable ?


Does that work for you ?

Regards,

Priyesh.
Back to top
View user's profile Send private message
Aravind Kumar. S

New User


Joined: 28 Apr 2005
Posts: 26

PostPosted: Mon Jul 04, 2005 1:52 pm
Reply with quote

Hi ,

In this case, my string contains no spaces in between.I used Inspect verb. it's working fine.

can u help me for this scenario,

Search string = abcd
IN-STRING = memberabcd (contains spaces,#,numbers also)

I want to Compare first character of Search string with the characters in IN-STRING until match is found.
If a character is matching, then read the next character in Search string and compare it with the character following the matching character in IN-STRING.
If end of the field in-string is reached and no matching character found display errror.

is there any verb for comparison in cobol ?



Thanks,
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 4:24 pm
Reply with quote

I think I have already given solution for this in another POST by you only.

http://www.ibmmainframes.com/viewtopic.php?t=4083

Regards,

Priyesh.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jul 05, 2005 12:06 am
Reply with quote

Hi Arivend,

Try something like this:

INSPECT FUNCTION REVERSE(TEXT1) TALLYING L FOR LEADING SPACES
COMPUTE L = LENGTH OF TEXT1 - L

L is the ending position of the string.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
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
Search our Forums:

Back to Top