Cobol 文件状态 9 是什么意思?

What does Cobol file status 9Â mean?

我的问题是当我尝试打开一个巨大的文件 (6GB) 时, 有一条消息说:

cobol file status code 9Â

我编译了程序,没有错误,但是当我尝试 运行 时, 我使用一个小的(例如 3 GB)我的程序工作正常。

有什么想法吗?

变量声明:

SELECT                                                       
MYFILE ASSIGN     MYFILE
ACCESS SEQUENTIAL 
STATUS IS XZ-STATUS6.  
===
OPEN INPUT  MYFILE 
===
READ  MYFILE NEXT AT  END  MOVE  1  TO  ZFIN-F3

您可能想看看 this link,其中包含一些可能适用于您的情况的信息。其中包含的一些信息:

  1. 关于文件状态

If you have a file status data-item defined for a file, then after every input/output operation on the file (OPEN, CLOSE, READ, WRITE, REWRITE, START and DELETE) the run-time system updates it to indicate how the operation completed.

Defining a file status data-item is optional. If a file status data-item is not declared and a serious file error occurs, the COBOL run-time system displays an error message and aborts your program.

You should check the file status data-item after each input/output operation, to see if the operation completed successfully.

  1. 关于文件状态数据项

File status is a two-byte code. If the first byte of the file status data-item contains value 9, it indicates a COBOL run-time system error. In that case, the second byte is a binary field containing an error code.

  1. 示例代码(ws-file-status对应你的XZ-STATUS6)

     ...
     working-storage section.
     01 ws-file-status.
        05 status-key-1                          pic x.
        05 status-key-2                          pic x.
        05 binary-status redefines status-key-2  pic 99 comp-x.
     ...
     ...
     procedure division.
     ...
     perform check-status.
     ...
     check-status.
        evaluate status-key-1
           when "0" next sentence
           when "1" display "end of file reached"
           ...
           when "9" display "run-time-system error"
              perform check-mf-error-message
        end-evaluate.
     ...
     check-mf-error-message.
        evaluate binary-status
           when 002 display "file not open"
           when 007 display "disk space exhausted"
           when 013 display "file not found"
           when 024 display "disk error    "
           when 065 display "file locked      "
           when 068 display "record locked    "
           when 039 display "record inconsistent"
           when 146 display "no current record  "
           when 180 display "file malformed     "
           when 208 display "network error      "
           when 213 display "too many locks     "
           when other display "not error status "
           display binary-status
        end-evaluate.
    

请注意确定您的(奇怪的)值 Â 是否与 binary-status 列出的任何值(在 check-mf-error-message 内)相对应,但至少它应该有助于找出如何正确显示您的实际文件状态代码。

感谢大家宝贵的反馈,问题在于我用来计算一些大数的数组的大小,我已将我的数组设置为最大值,现在工作正常