将显示结果存储在 PIC X(n) 中
Store DISPLAY results in a PIC X(n)
图片子句定义了 DISPLAY 命令输出到控制台的格式。
有没有办法 "output" 格式化字符串到变量?类似于以下内容,但有效。下面是任意一个数字的例子,通过图片转换,以货币格式存储在字符串中。
IDENTIFICATION DIVISION.
PROGRAM-ID. Demo1234.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Price Pic $$$,$.99.
01 Formated-Output Pic X(10).
PROCEDURE DIVISION.
Move 10.50 to Price.
Display Price Upon Formated-Output.
*> Formated-Output would now contain ".50 "
GOBACK.
将此行添加到 WORKING-STORAGE
。
01 Start-pos Pic 9(4) Binary.
将 Display Price
语句替换为
Move 1 to Start-pos
Inspect Price tallying
Start-pos for leading spaces
Move Price (Start-pos:) to Formated-Output
结果".50"
后跟4个空格在Formated-Output
.
图片子句定义了 DISPLAY 命令输出到控制台的格式。 有没有办法 "output" 格式化字符串到变量?类似于以下内容,但有效。下面是任意一个数字的例子,通过图片转换,以货币格式存储在字符串中。
IDENTIFICATION DIVISION.
PROGRAM-ID. Demo1234.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Price Pic $$$,$.99.
01 Formated-Output Pic X(10).
PROCEDURE DIVISION.
Move 10.50 to Price.
Display Price Upon Formated-Output.
*> Formated-Output would now contain ".50 "
GOBACK.
将此行添加到 WORKING-STORAGE
。
01 Start-pos Pic 9(4) Binary.
将 Display Price
语句替换为
Move 1 to Start-pos
Inspect Price tallying
Start-pos for leading spaces
Move Price (Start-pos:) to Formated-Output
结果".50"
后跟4个空格在Formated-Output
.