In this topic, we described about the Display Computation with detailed example.
DISPLAY Computation specifies the data item stored in character form. In DISPLAY computation, one character is equal to one byte (8 bits). This mechanism corresponds to the format used for printed output.DISPLAY can be explicit or implicit. USAGE IS DISPLAY is valid for the following data types -
- External floating-point
- External decimal
External decimal items with USAGE DISPLAY are sometimes referred as zoned decimal items. Each digit of a number is represented by a single byte. i.e. - 1 digit/Char= 1 byte
If the ARITH(COMPAT) compiler option is used, the maximum length of an external decimal item is 18 digits. If the ARITH(EXTEND) compiler option is used, the maximum length of an external decimal item is 31 digits.
Let’s take an example for displaying all data types which are passing through program and see how it is after writing to the program.
The above example, writing the record from the working-storage record and see how it is displayed during the file browse.
In the program, all variables declared with DISPLAY USAGE. In the DISPLAY USAGE, 1 digit/char equal to 1 byte.
So there should be no change in the output when we displayed on it.
The program output writing to MTH.COMP.OUTPUT file.
The below output shows the output written by the program and no change in the OUTPUT written from the input passed in the program.