3 ms·
COBOL's data types look like they're well-suited to storing fixed-width, hierarchical data, with the format of the data being specified in the data type. The nu
by khedoros1 9y ago
COBOL's data types look like they're well-suited to storing fixed-width, hierarchical data, with the format of the data being specified in the data type. The numerical types are oriented toward fixed-point decimal, with explicitly specified levels of precision.
Two variables holding common license plate formats might look like this:
01 LIC-PLATE1 PIC 9A(3)9(3) VALUE '1ABC234'.
01 LIC-PLATE2 PIC 9(3)A(3). VALUE '123ABC'.
[edit: added a newline to separate my examples]
("9" specifies a numerical digit, "A" specifies an alphabetic character, and there are other types that deal with sign, explicit and implicit decimal points, etc).
Assembly deals with memory layouts, but doesn't enforce any kind of higher-level data type, and especially not a human-oriented data specification.