# File status 49: REWRITE or DELETE on a file not open I-O

Source: https://wndsoftware.com/mainframe-errors/file-status-49

### File status 49: REWRITE or DELETE on a file not open I-O

File status 49 means a REWRITE or DELETE was issued for a file that isn't open in I-O mode. Updating or deleting existing records needs OPEN I-O.


#### Other names for this code

Also written as `FS 49`, `file status code 49`, `COBOL status 49`, `status key 49`, `REWRITE not open I-O`, `SK49`.


### What it means

Status 49 is a logic error. REWRITE changes a record that's already in the file, and DELETE removes one. Both need the file open for input and output at once, which COBOL calls I-O mode. A file that's closed, or open INPUT, OUTPUT or EXTEND, gets 49.

Which files support these statements at all also matters. For QSAM, REWRITE works only on a disk data set opened I-O, and DELETE isn't available for sequential files. An ESDS is a sequential file to COBOL, so it allows REWRITE in I-O mode but not DELETE. A KSDS or RRDS allows both in I-O mode, whatever the access mode. Line-sequential files allow neither.

Under the older CMPR2 behavior 49 was reported as 92. Like 47 and 48, it often follows an OPEN that failed without being checked.


### Common causes

- The file was opened INPUT for a read-only version of the program, and update logic was added later without changing the OPEN.
- OPEN I-O failed, for example with 35 on a VSAM cluster that was never loaded or 37 on a tape, and the status wasn't checked.
- The file was opened OUTPUT to load it, and the program then tries to REWRITE records without closing and reopening it I-O.
- An update runs after the file was closed in an end-of-job routine.


### How to find the problem

- DISPLAY the status of the OPEN for the file.
- Check the open mode on the OPEN statement. REWRITE and DELETE need I-O.
- Trace any CLOSE that can run before the REWRITE or DELETE.


### How to fix it

- Open the file I-O when the program updates or deletes records.
- Check the status after every OPEN and stop if it fails.
- After loading a file with OPEN OUTPUT, CLOSE it and OPEN it I-O before updating.
- Use DISP=OLD on the DD of a QSAM file updated in place, so no other job reads it while it's half updated.


### IBM documentation

[IBM Enterprise COBOL documentation](https://www.ibm.com/docs/en/cobol-zos/6.4.0). 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.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Last reviewed 2026-10-18 by the WND Software team. Written in our own words. For the full reference, check IBM’s Enterprise COBOL documentation for your release.


### Related codes

[File status 43 REWRITE or DELETE without a prior READ Read →](https://wndsoftware.com/mainframe-errors/file-status-43)
[File status 48 WRITE on a file not open for output Read →](https://wndsoftware.com/mainframe-errors/file-status-48)
[File status 47 READ on a file not open for input Read →](https://wndsoftware.com/mainframe-errors/file-status-47)
[File status 37 OPEN mode not supported by the file Read →](https://wndsoftware.com/mainframe-errors/file-status-37)
[File status 35 Required file not available at OPEN Read →](https://wndsoftware.com/mainframe-errors/file-status-35)

### Questions


#### What is the difference between 49 and 43?

49 means the file isn't open I-O, so updates aren't allowed. 43 means the file is open I-O, but the REWRITE or DELETE didn't follow a successful READ in sequential access.


#### Can I DELETE a record from a sequential file?

No. DELETE works on indexed and relative files only. For a sequential file, copy it and leave out the records you don't want.

[COBOL file status codes](https://wndsoftware.com/mainframe-errors/cobol-file-status) · [File status 48](https://wndsoftware.com/mainframe-errors/file-status-48) · [File status 90](https://wndsoftware.com/mainframe-errors/file-status-90)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
