COBOL程序编译报错GYDS1145-S

今天编译一个COBOL老程序的时候报错:IGYDS1145-S

IGYDS1145-S More than 18 digit positions were specified in a "PICTURE" string for a numeric or numeric edited item.
A "PICTURE" string of "S9(18)" was assumed.

原因是老的编译器不支持超过18位的长度变量,但是新的编译器支持。这个帖子里有讨论得更多。 http://ibmmainframes.com/post-9087.html

COBOL Compiler restricts me defining a PIC 9() variable not more than of size 18 (Including the decimal positions)
The new Enterprise COBOL for z/OS supports upto 31 digits. If you have this, add ARITH(EXTEND) compiler option.

解决办法是添加编译参数扩展长度:

COMPILE PARMS:     ARITH(EXTEND)                                                           

或者也可以在代码里面体现:

CBL ARITH(EXTEND)                                      
IDENTIFICATION DIVISION. 

Comments !