The picture clause defines the format which the DISPLAY command would output to the console. Is there a means to "output" the formatted string to a variable? Something like the following, but something that works. The following is an arbitrary example of a number, transformed by a picture, and stored in a string in the currency format.
IDENTIFICATION DIVISION.
PROGRAM-ID. Demo1234.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Price Pic $$$,$$9.99.
01 Formated-Output Pic X(10).
PROCEDURE DIVISION.
Move 10.50 to Price.
Display Price Upon Formated-Output.
*> Formated-Output would now contain "$10.50 "
GOBACK.
Add this line to
WORKING-STORAGE
.Replace the
Display Price
statement withThe result,
"$10.50"
, followed by 4 spaces is inFormated-Output
.