我有Ubuntu 12.04.5,我已经安装了GnuCOBOL平台,我已经编程了GnuCOBOL一段时间没有问题。
我现在正在做一些非常微不足道的事情:我有一个程序MULT03.cob,我编译并运行如下:
martin@martin-1001PX:~/CobolProjects$ cobc -b MULT03.cob
martin@martin-1001PX:~/CobolProjects$ cobcrun MULT03
Which multiplication table (01-99)? 4
How many entries to the table (01-999)? 5
How many lines maximally in one round of output (0-99)? 2
The 04`s (possibly extended) table is:
04 * 001 = 0004
04 * 002 = 0008
Press Enter to continue...
04 * 003 = 0012
04 * 004 = 0016
Press Enter to continue...
04 * 005 = 0020
martin@martin-1001PX:~/CobolProjects$
然后我做的是我在程序代码中引入了一个真正微观的变化(我确定问题是在更高层次上,在链接/环境变量或其他方面,但我没有改变任何东西)并得到
martin@martin-1001PX:~/CobolProjects$ cobc -b MULT04.cob
martin@martin-1001PX:~/CobolProjects$ cobcrun MULT04
libcob: ./MULT04.so: undefined symbol: MULT04
martin@martin-1001PX:~/CobolProjects$
MULT04.cob基本上是MULT03.cob,更改了两行。两者都在目录,源代码,目标代码和所有:
中martin@martin-1001PX:~/CobolProjects$ ls MU*
MULT02.cob MULT03.cob MULT04.cob MULTAB.cob
MULT02.so MULT03.so MULT04.so MULTAB.so
我很想知道是什么让运行时系统找到了一个而不是另一个。我尝试过以不同的方式命名MULT04(不应该是必需的,只是为了排除错误源)。其他早期的程序编译运行没有问题:
martin@martin-1001PX:~/CobolProjects$ cobc -b BOILERPLATE.cob
martin@martin-1001PX:~/CobolProjects$ cobcrun BOILERPLATE
martin@martin-1001PX:~/CobolProjects$
这些是(稍有不同)代码段:
004100 CALCULATE-AND-DISPLAY.
004200 ADD 1 TO THE-MULTIPLIER.
004210
004220 ADD 1 TO INTERIM-LINE-NUMBER.
004230 IF INTERIM-LINE-NUMBER IS GREATER THAN THE-LIMIT-PER-ROUND
004235 MOVE 1 TO INTERIM-LINE-NUMBER
004240 DISPLAY "Press Enter to continue..." WITH NO ADVANCING
004250 ACCEPT THE-DUMMY.
004300 COMPUTE THE-PRODUCT = THE-NUMBER * THE-MULTIPLIER.
004400 DISPLAY
004500 THE-NUMBER " * " THE-MULTIPLIER " = " THE-PRODUCT.
004100 CALCULATE-AND-DISPLAY.
004200 ADD 1 TO THE-MULTIPLIER.
004210
004220 ADD 1 TO INTERIM-LINE-NUMBER.
004230 IF INTERIM-LINE-NUMBER IS EQUAL TO THE-LIMIT-PER-ROUND
004235 MOVE 1 TO INTERIM-LINE-NUMBER
004245 DISPLAY "Press Enter to continue..." WITH NO ADVANCING
004250 ACCEPT THE-DUMMY
004251 ELSE COMPUTE THE-PRODUCT = THE-NUMBER * THE-MULTIPLIER
004400 DISPLAY
004500 THE-NUMBER " * " THE-MULTIPLIER " = " THE-PRODUCT.
后一段是MULT04.cob,前MULT03.cob。
martin@martin-1001PX:~/CobolProjects$ diff MULT03.cob MULT04.cob
59c59
< 004230 IF INTERIM-LINE-NUMBER IS GREATER THAN THE-LIMIT-PER-ROUND
---
> 004230 IF INTERIM-LINE-NUMBER IS EQUAL TO THE-LIMIT-PER-ROUND
61,63c61,63
< 004240 DISPLAY "Press Enter to continue..." WITH NO ADVANCING
< 004250 ACCEPT THE-DUMMY.
< 004300 COMPUTE THE-PRODUCT = THE-NUMBER * THE-MULTIPLIER.
---
> 004245 DISPLAY "Press Enter to continue..." WITH NO ADVANCING
> 004250 ACCEPT THE-DUMMY
> 004251 ELSE COMPUTE THE-PRODUCT = THE-NUMBER * THE-MULTIPLIER
答案 0 :(得分:0)
问题是IF
块上的句号。尽量不要使用句号。相反,使用相应的范围终止符;在这种情况下END-IF
。
这应该有效:
004100 CALCULATE-AND-DISPLAY.
004200 ADD 1 TO THE-MULTIPLIER.
004210
004220 ADD 1 TO INTERIM-LINE-NUMBER.
004230 IF INTERIM-LINE-NUMBER IS EQUAL TO THE-LIMIT-PER-ROUND
004235 MOVE 1 TO INTERIM-LINE-NUMBER
004245 DISPLAY "Press Enter to continue..." WITH NO ADVANCING
004250 ACCEPT THE-DUMMY
004251 ELSE COMPUTE THE-PRODUCT = THE-NUMBER * THE-MULTIPLIER
END-IF
004400 DISPLAY
004500 THE-NUMBER " * " THE-MULTIPLIER " = " THE-PRODUCT.