Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us