我确信有一种更简单的方法可以做到这一点,但我是COBOL的新手.这段代码的某些部分会导致无限循环,在它向写入文件写入任何内容的部分之前,但我看不到位置; 我已经尝试重写它的多个部分,看起来它们可能是问题所在.我错过了什么?
具体问题是它会导致无限循环,即当我运行程序时,它会运行直到硬关闭并且什么也不做.所需的行为是程序访问Ch10_payroll.DAT文件,读取有关九个地区中每个地区的人员年薪的信息,并将每个地区的年度总工资写入Ch10_payroll.RPT文件.
...
Working-Storage Section.
...
01 WS-Total-1 PIC 9(6) Value Zeroes.
01 WS-Total-2 PIC 9(6) Value Zeroes.
01 WS-Total-3 PIC 9(6) Value Zeroes.
01 WS-Total-4 PIC 9(6) Value Zeroes.
01 WS-Total-5 PIC 9(6) Value Zeroes.
01 WS-Total-6 PIC 9(6) Value Zeroes.
01 WS-Total-7 PIC 9(6) Value Zeroes.
01 WS-Total-8 PIC 9(6) Value Zeroes.
01 WS-Total-9 PIC 9(6) Value Zeroes.
01 WS-Territory-No PIC 99 Value Zeroes.
...
01 Detail-Line.
05 PIC X(3) Value Spaces.
05 Territory-No-Out PIC 99.
05 …Run Code Online (Sandbox Code Playgroud)