cobolmicrofocuscobol85cobol.netprocobol

What does Cobol file status 9Â mean?


My issue is when I try to open on input a huge file (6GB) , there's a message that says:

cobol file status code 9Â

I compiled the program and it has no errors, but when I try to run it, I use a small one (3 GB for example) my program work correctly.

Any ideas ?

Variable declaration:

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

Solution

  • You may want to have a look at this link, which includes some info which may apply in your case. Some of the info included there:

    1. About File Status

    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. About a file status data-item

    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. Example code (ws-file-status corresponds to your 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.
      

    Note sure if your (bizarre) value  will correspond with any of the listed values for binary-status (within check-mf-error-message), but at least it should help find out how to correctly display your actual file status code.