33 lines
922 B
Plaintext
33 lines
922 B
Plaintext
Initializing a data item with a value of the wrong type will lead to runtime errors. The rule checks that numeric data items are not initialized with alphanumeric/alphabetic values and that alphanumeric /alphabetic data items are not initialized with numeric values.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
WORKING-STORAGE SECTION.
|
|
EJECT
|
|
01 TAB-POS.
|
|
02 FILLER PIC A(14) VALUE 0. *> Noncompliant
|
|
02 FILLER PIC 9(14) VALUE 'ASDFJKL;QWERTY'. *> Noncompliant
|
|
|
|
01 MYGROUP PIC 9(1).
|
|
88 X VALUE 1,2.
|
|
88 Y VALUE 3, "BLUE". *> Noncompliant; BLUE is alphanumeric
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
WORKING-STORAGE SECTION.
|
|
EJECT
|
|
01 TAB-POS.
|
|
02 FILLER PIC A(14) VALUE 'ASDFJKL;QWERTY'.
|
|
02 FILLER PIC 9(14) VALUE 0.
|
|
|
|
01 MYGROUP PIC 9(1).
|
|
88 X VALUE 1,2.
|
|
88 Y VALUE 3, 4.
|
|
----
|
|
|