From the course: COBOL Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Literal and figurative constants

Literal and figurative constants - COBOL Tutorial

From the course: COBOL Essential Training

Start my 1-month free trial

Literal and figurative constants

- [Instructor] In COBOL, we can have both numeric and non-numeric literals where a literal is an exact value or a constant. The rules for numeric literals include; A numeric literal can be up to 18 digits long, it can begin with a leading or leftmost plus or minus sign, and it can contain a decimal point, but it may not end with a decimal point. A non-numeric literal is enclosed in apostrophes or quotation marks as specified by the compiler. And finally, a non-numeric literal may contain anything, including spaces, numbers, and even reserved words, but it cannot contain another apostrophe. In addition to literals, COBOL also have something called figurative constants. And they're reserved words that name and refer to specific constant values. Here are some of the more commonly used figurative constants. We have high values and low values. We've already seen high values as an indicator to indicate the end of file. We can…

Contents