IGZ0035S: Unsuccessful OPEN or CLOSE with no FILE STATUS
IGZ0035S means a COBOL program's OPEN or CLOSE of a file failed, and the program had neither a FILE STATUS clause nor an error declarative to deal with it, so the runtime ended the program. The file status code at the end of the message, most often 35, says why the OPEN or CLOSE failed.
Other names for this code
Also written as IGZ0035, IGZ35S, IGZ0035S status code 35, IGZ0035S 39, IGZ0035S U4038, unsuccessful OPEN or CLOSE of file.
What it means
When a COBOL program opens or closes a file, the runtime sets a two-digit file status. A program can check it in two ways. It can name a FILE STATUS field for the file and test it after each statement, or it can code an error declarative (a USE AFTER ERROR procedure) that runs when an I/O statement fails. If the OPEN or CLOSE fails and the program has done neither, the runtime has no one to hand the error to. It writes IGZ0035S and ends the program.
The message names the file (the name from the SELECT clause, not the DD name), the program and where in the program the statement is. It also says that neither FILE STATUS nor an ERROR declarative was specified, and it ends with the status code. Newer runtimes add a line with the compile unit, entry point and offset.
The status code is what you need. Status 35 means a required file wasn't there for an OPEN INPUT, I-O or EXTEND. Status 39 means the file's attributes don't match the program's description of it. Status 37 means the file can't be opened in the mode asked for. Status 96 means there was no DD statement for a file the OPEN would create, such as a VSAM file opened OUTPUT. Status 98 means dynamic allocation failed, or an environment variable named in the ASSIGN clause held something invalid.
Under Language Environment, the step then ends with user abend U4038. An IBM APAR for an older COBOL runtime shows the same failure ending with abend 1035.
Common causes
- Status 35 means the DD statement points at a data set that doesn't exist, or the file isn't available. A VSAM cluster that was defined but never loaded also gives 35 on OPEN INPUT.
- Status 39 means the record length, record format or organization in the FD doesn't match the data set, for example an FD for a sequential file pointing at a VSAM data set.
- Status 37 means the OPEN mode doesn't fit the file, such as OPEN OUTPUT on a data set that can't be written.
- Status 96 means a VSAM file had no DD statement for an OPEN OUTPUT, or for OPEN I-O or EXTEND on an OPTIONAL file.
- Status 98 means dynamic allocation of the file failed, or an environment variable in the ASSIGN clause has bad contents.
How to find the problem
- Read the status code at the end of IGZ0035S, and the file name and program. Map the file name to its DD name through the program's SELECT ... ASSIGN clause.
- Look just above it in the job log for system messages about the same DD. IEC130I means the DD statement was missing. IEC141I gives the reason for an open failure on a sequential file. IEC161I gives VSAM open errors.
- For status 35, check that the DD statement exists and that the data set it names exists. For a VSAM file, run
LISTCAT ENTRIES('PROD.and see whether it has ever held records.PAYROLL. MASTER') ALL - For status 39, compare the FD (RECORD CONTAINS, RECORDING MODE, ORGANIZATION) with the data set's real attributes in ISPF 3.4 or LISTCAT.
- Check the IEF450I line. Under Language Environment it shows
ABEND=S000 U4038for this failure.
How to fix it
- Correct the cause the status code points to, such as adding the missing DD, creating or loading the data set, or fixing the FD.
- Add a FILE STATUS clause for every file and test it after each OPEN and CLOSE. The program can then report the problem clearly and set a return code instead of abending.
- If a file is allowed to be absent, declare it OPTIONAL in the SELECT clause. An OPEN INPUT of a missing optional file then succeeds with status 05.
- Prime a new VSAM cluster with a dummy record, or have the first program open it OUTPUT, so later OPEN INPUT calls don't get 35.
What it looks like
IGZ0035S There was an unsuccessful OPEN or CLOSE of file CUSTIN in program PAYEXTR.
Neither FILE STATUS nor an ERROR declarative were specified. The status code was 35.
From compile unit PAYEXTR at entry point PAYEXTR at compile unit offset +00000452
IEF450I PAYRUN01 STEP010 - ABEND=S000 U4038 REASON=00000001IBM documentation
IBM z/OS documentation. Use the documentation for your installed release.
This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.
Related codes
Questions
Why does IGZ0035S end with abend U4038?
The runtime treats the failed OPEN as a severe error because nothing in the program handles it. Language Environment then ends the program, and with the usual runtime options that ending is user abend U4038.
Will adding a FILE STATUS clause fix IGZ0035S?
It stops the abend, but not the underlying problem. The program has to test the status after the OPEN, because otherwise it carries on and fails later on a READ or WRITE.
The file name in IGZ0035S doesn't match any DD name. Why?
The message gives the COBOL file name from the SELECT clause. The ASSIGN clause on that SELECT names the DD that was used.