MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking the length of a string

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
badri5
Banned


Joined: 27 Jun 2006
Posts: 18
Topics: 16

PostPosted: Tue Sep 01, 2009 7:54 am    Post subject: Checking the length of a string Reply with quote

I want to check the length of a string in cobol.

Here is the example

ws-var1 pic x(17) .

1st record----abcdefghijklm

I checked like this
If ws-var1(1:17) not = ' '
and
If ws-var1(1:17) not = ' '-----17 spaces
and
if ws-var1(1:17) not = spaces

The above example is 13 characters.rest 4 characters are spaces.But it is accepting.
i checked like the above conditions.but even if it is 13 characters it is accepting.If it is 17 characters only it should accept.even if 17th character is a space it should not accept.
Could you kindly tell me how to code for this logic for this
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Sep 01, 2009 8:37 am    Post subject: Reply with quote

badri,

Please search before posting


http://www.mvsforums.com/helpboards/viewtopic.php?p=5743#5743

http://www.mvsforums.com/helpboards/viewtopic.php?t=1282&highlight=length

http://www.mvsforums.com/helpboards/viewtopic.php?t=525&highlight=length

http://mvsforums.com/helpboards/viewtopic.php?t=3185&highlight=length

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group