Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
ending position of the string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: ending position of the string
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: 1452
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 1:21 pm    Post subject: Re: ending position of the string
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    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Mon Jul 04, 2005 4:24 pm    Post subject: Re: ending position of the string
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us