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
 

 

Cobol Conditions to check a variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
santohsks1987
Warnings : 1

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Thu Mar 10, 2011 11:24 am    Post subject: Cobol Conditions to check a variable
Reply with quote

Hi,

Cobol Variable "NAME" should be only alpha, apostrophe,period or dash else i should generate the error.

Please guide me on how to perform this check on the variable. icon_smile.gif
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Mar 10, 2011 12:13 pm    Post subject: Re: Cobol Conditions
Reply with quote

santohsks1987 wrote:
Hi,

Cobol Variable "NAME" should be only alpha, apostrophe,period or dash else i should generate the error.

Please guide me on how to perform this check on the variable. icon_smile.gif


hard to guide you when we do not know what you are doing when
Quote:

i should generate the error.


why not wait for the compiler?
Back to top
View user's profile Send private message
santohsks1987
Warnings : 1

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Thu Mar 10, 2011 12:18 pm    Post subject:
Reply with quote

I have a variable NAME, I am performing validations on this variable and the check which i have to do is

If NAME = alpha, apostrophe, period or dash
continue
else
set error-flag
end-if

How to perform the if check
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Mar 10, 2011 12:34 pm    Post subject:
Reply with quote

you could use the CLASS Clause found in COBOL Reference and the PROGRAMERS Guide
Back to top
View user's profile Send private message
Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Fri Mar 11, 2011 12:23 pm    Post subject:
Reply with quote

Please go through the below link.

http://www.cobolportal.com/resources/articles/20000403_001.asp?bhcp=1
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


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