declare constants

swapna namburu
Posts: 6
Joined: Wed Sep 08, 2010 2:27 pm
Skillset: cobol,db2,jcl,cics,vsam
Referer: in google

declare constants

Postby swapna namburu » Fri Sep 10, 2010 12:20 am

How to declare constants in cobol.
thats mean we can't change that value through out the program.

User avatar
dick scherrer
Global moderator
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am

Re: declare constants

Postby dick scherrer » Fri Sep 10, 2010 12:24 am

Hello,

Anything that can be "declared" can be modified. . .

It is the responsibility of the programmer to ensure that values that are to remain constant are not modified.
Hope this helps,
d.sch.

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

Re: declare constants

Postby Robert Sample » Fri Sep 10, 2010 12:28 am

COBOL has a few figurative constants (such as ZERO, SPACE, HIGH-VALUES, LOW-VALUES) however it does not have the ability to declare constants as non-changeable values per se. What are you wanting to do, specifically? Perhaps there's a way to achieve your goal without requiring constants.