在Ubuntu 18.10上使用GnuCOBOL 2.2.0。Michael Coughlan撰写的“面向程序员的COBOL入门”一文。直到第9章,GnuCOBOL一直在毫不费力地编译本书的示例,当时该程序:
IDENTIFICATION DIVISION.
PROGRAM-ID. Listing9-2.
AUTHOR. Michael Coughlan.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
CURRENCY SIGN IS "£".
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Edit1 PIC £££,££9.99.
PROCEDURE DIVISION.
Begin.
MOVE 12345.95 TO Edit1
DISPLAY "Edit1 = " Edit1
STOP RUN.
Run Code Online (Sandbox Code Playgroud)
...在尝试编译时抛出以下错误:
~/Documents/COBOL$ cobc -x -free Listing9-2.cbl
Listing9-2.cbl: 8: error: PICTURE SYMBOL for CURRENCY must be one character long
Listing9-2.cbl: 11: error: invalid PICTURE character '?'
Listing9-2.cbl: 11: error: invalid PICTURE character '?'
Listing9-2.cbl: 11: error: invalid PICTURE character …Run Code Online (Sandbox Code Playgroud)