IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Cobol Conditions to check a variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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
Reply with quote

Please go through the below link.

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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts How to load to DB2 with column level ... DB2 6
Search our Forums:

Back to Top