Skip to main content

A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

what 'is the file status after the open?


A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

qual' è il file status dopo la open?


A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

I need to find the file status, but I don't know how to code the program to capture it


A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

it must be so

in        INPUT-OUTPUT SECTION.

           FILE-CONTROL.

          SELECT FILE ASSIGN TO FILE

                 ORGANIZATION IS SEQUENTIAL

                 FILE STATUS IS FLS-STATUS.

in working storage mast be declared as:

      01  FS-FINOUT                          PIC XX.

in procedure division:

             OPEN INPUT FILE

             IF FLS-STATUS NOT = "00"

                  DISPLAY "ERROR OPEN FILE STATUS IS " FLS-STATUS

             END-IF

Bye


A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

sorry in working storage mast be declared as:

     01  FLS-STATUS                          PIC XX.


A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

The Micro Focus file handler produces Extended File Status Codes.  For complete information, look up the subject of "Extended File Status Codes" in the index of the documentation.

Examine the two-byte file status after each I/O statement.  If the first byte of the file status is "9", the second byte must be interpreted as a binary field, PIC 99 USAGE COMP-X.

If the first byte is not "9", the second byte must be interpreted as PIC X usage display.

Here is a code sample:

select file1 assign to disk "file1"
file status is  ans74-file-status
organization line sequential.

fd file1.
01 file-1-rec pic x(80).

working-storage section.
01 ans74-file-status.
     05 status-key-1              pic x.
     05 status-key-2              pic x.
     05 status-key-2-binary redefines status-key-2 
                                  pic 99 comp-x.
01 display-ext-status.
     05 filler                    pic xx value "9/".
     05 display-key-2             pic 999.

procedure division.
open i-o file1.
perform status-check
write file-1-rec from "A".
perform status-check
stop run.

status-check.
         if status-key-1 = "9"
             move status-key-2-binary to display-key-2
             display display-ext-status
         else
              display ans74-file-status
         end-if.

A job and program that has been running for 15 years, fails in the 'OPEN' statement. What do I specifically do to capture the error? If I remove input file 'MINI-FILE', it makes it past the 'OPEN' statement, (DISPLAY statements everywhere), so I think that file is the problem

you can define file status so:

01 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.

end then

if fls-status not = "00"

  if status-key-1 = 9

      display "extend fls : " binary-status

  else

      display " file status : " file-status

  end-if

end-if