## COBOL examples using numeric constants:

1. MULTIPLY AMT-INPUT BY .05
GIVING ANS-WS.

(note that 5% is written as a number .05 with the actual decimal
point)

**OR**

you could create a working storage area for the constant .05 and use the
name you give the constant in the multiply statement.

01 CONSTANTZ.
05 FIVE-PER-WS PIC V99 VALUE .05.

(note that the picture has the assumed decimal point V while the
value has the actual decimal point - these must line up to make the percent
correct)

MULTIPLY AMT-INPUT BY FIVE-PER-WS
GIVING ANS-WS.

2. SUBTRACT 24.75 FROM AMT-INPUT
GIVING RSLT-WS.

(notice that the number you are subtracting, 24.75 is written
in the math statement with the actual decimal point)

**OR**

you could
create a working storage area for the constant 24.75 and use the
name you give the constant in the subtract statement.

01 CONSTANTZ.
05 DISC-AMT-WS PIC 99V99 VALUE 24.75.

(again note that the assumed decimal point V in the PIC clause
lines up with the actual decimal point in the VALUE clause)

SUBTRACT DISC-AMT-WS FROM AMT-INPUT
GIVING RSLT-WS.
3. MOVE "ERROR IN RECORD" TO MSG-PR.

**OR**

you could set up a place for the error message in
working storage and move the name of the message to the print line instead
of the actual message.

01 MSG-CONSTANTS.
05 ERROR-MSG PIC X(15) VALUE "ERROR IN RECORD".
MOVE ERROR-MSG TO MSG-PR.