View previous topic :: View next topic
|
Author |
Message |
Aravind Kumar. S
New User
Joined: 28 Apr 2005 Posts: 26
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
Aravind Kumar. S
New User
Joined: 28 Apr 2005 Posts: 26
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|