Numeric and Non Numeric Literal in COBOL

Literals in COBOL:

The actual values can also appear in a program. Such values are known as literals.
Example: The statement MOVE 0 TO TOTAL indicates that the value zero will be moved to the variable TOTAL. This constant 0 which is used in the body of the statement is literal.
There are 3 types of literals:
i. Numeric
ii. Non-Numeric.
iii. Figurative Constants

Numeric Literal in COBOL:

A numeric literal can be formed with the help of digits only. It can have a sign (+ or –) and can have a decimal point also. If no sign is specified the literal will be taken as positive.

Negative literals are indicated by the – sign at the leftmost end. If no decimal point is used then the literal is an Integer. If a decimal point is used, it must come in between the digits. The maximum number of digits allowed in a numeric literal is compiler-dependent.

Non Numeric Literal in COBOL:

A non-numeric literal is used in general to output messages or headings. Characters that are enclosed between ” ” constitute non-numeric literal. The maximum number of characters that are allowed within two quotation marks is compiler-dependent.

Figurative Constants:

Figurative constants have some fixed names and the compiler recognizes these names and it sets up corresponding values in the object program.