Previous Topic: Alphanumeric LiteralsNext Topic: Hexadecimal Literals


Numeric Constants

When writing a Reporting Facility program, you may need to establish a constant numeric value by coding a numeric constant. Numeric constants can be preceded by a sign (+ or -) and must consist of digits in the range 0 to 9. You can code up to 15 digits in any single numeric constant. You can place a decimal point anywhere within the constant.

The constant is assumed to be positive if no sign is specified. The precision and length of the constant are automatically calculated and internally stored in packed decimal format.

The following table illustrates rules for coding numeric constants:

Coded String

Net Length

Precision

123.45
+.6234
-146
-000.0007
1234567890
98765.43219
0
-
+1
1
2.00000000
+123456789012345
.123456789012345
-98765432101.33

3
3
2
4
6
6
1
1
1
1
5
8
8
7

(3.2)
(0.4)
(3.0)
(3.4)
(10.0)
(5.5)
(1.0)
(1.0)
(1.0)
(1.0)
(1.8)
(15.0)
(0.15)
(11.2)

You can code numeric constants on these commands:

ADD
CALL
COMPUTE
DECODE
DECREMENT
DEFINE

DIVIDE
GET
GOTO
INCREMENT
MOVE
MULTIPLY

PRINT
REPORT
SELECT
SET
SUBTRACT