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 RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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