REWRITE
Updates a record in a file.
Syntax
- DATASET is also accepted, but FILE is preferred.
- LENGTH is required with SYSID, and with FROM when rewriting variable-length records.
- DSIDERR is equivalent to FILENOTFOUND.
Description
REWRITE updates a record in a file that is on a local or a remote system. You must always precede this command with a READ UPDATE to read the record that is to be updated.
EXEC CICS REWRITE
FROM(RECORD)
FILE('MAIN')Options
- FILE(name)
- Specifies
the name of the CICS® file that is to be accessed. The name must
be alphanumeric, up to eight characters long, and the file must be
currently UPDATABLE (see INQUIRE FILE).
If a non-local SYSID is specified, the underlying file is assumed to reside on a remote system, irrespective of whether the name exists in the local File Definitions (FD). Otherwise, the FD entry is used to determine whether the underlying file is on a local or a remote system.
- FROM(data-area)
- Specifies the record that is to be written to the file.
- LENGTH(data-value)
- Specifies,
as a 16-bit binary value, the length of the record that is to be written.
If SYSID is specified, LENGTH must be coded. You must also specify this option for a file that is defined as containing variable-length records. It need not be specified if the file contains fixed-length records, although its inclusion is recommended because this causes a check to be made that the length of the record that is being written is equal to that which is defined for the underlying file. If the lengths are not equal, the LENGERR condition occurs. For more information about using this option, see LENGTH.
- SYSID(name)
- Specifies
on which CICS region the REWRITE is to run. The SYSID
name has one through four characters. For a full description of the
SYSID option, see SYSID.
If the SYSID option is not specified, it defaults to the value that is in the RemoteSysId attribute of the FD entry for the file that is requested in the FILE option.
If the SYSID option requests a remote SYSID, you must also specify LENGTH.
Conditions
- DISABLED
- Occurs
if the specified file is disabled. A file might be disabled because:
- It was initially defined as disabled and has not since been enabled.
- It has been disabled by an EXEC CICS SET FILE command or by the CEMT transaction.
Default action: Terminates the task abnormally.
- DUPREC
- Occurs
if the underlying file has an active alternative index that accepts
only unique keys, and the record that is to be updated for this index
has a key that duplicates an existing value.
Default action: Terminates the task abnormally.
- FILENOTFOUND
- Occurs
if the name that is specified in the FILE option cannot be found in
the FD.
Default action: Terminates the task abnormally.
- ILLOGIC
- Occurs
if an error occurs that does not fall within one of the other CICS response
categories. (Further information is available in the EIBRCODE field;
for details, see EXEC interface block (EIB) fields.)
Default action: Terminates the task abnormally.
- INVREQ
- Occurs
for the following conditions, depending on the options that are specified
on the REWRITE command:
- A REWRITE command is issued for a file that has not had a previous READ UPDATE successfully issued.
Default action: Terminates the task abnormally.
- IOERR
- Occurs
if an I/O error occurs during the file control operation. An I/O error
is any unusual event that is not covered by a CICS condition.
(Further information is available in the EIBRCODE field; for details,
see EXEC interface block (EIB) fields.)
For information about handling the IOERR condition, see IOERR condition processing.
Default action: Terminates the task abnormally.
- ISCINVREQ
- Occurs
if the remote system indicates a failure that does not correspond
to a known condition.
Default action: Terminates the task abnormally.
- LENGERR
- Occurs
for the following conditions:
- The specified length exceeds the maximum record size; the data was truncated when written.
- The specified length is smaller than the record size for a file that has fixed-length records, the data is written to the start of the record, and the remainder of the record is padded with null bytes.
Default action: Terminates the task abnormally.
- NOSPACE
- Occurs
if the direct access device has no available space for the addition
of the updated record to the underlying file.
Default action: Terminates the task abnormally.
- NOTAUTH
- Occurs
for the following conditions:
- When a resource security check is unsuccessful on FILE(name)
- When SYSID is specified by a transaction that is defined with the RSLCheck attribute set to either internal or external
Default action: Terminates the task abnormally.
- NOTOPEN
- Occurs
for the following conditions:
- The requested file is CLOSED and UNENABLED. The CLOSED, UNENABLED state is reached after a CLOSE request has been received against an OPEN ENABLED file, and the file is no longer in use.
- The requested file is OPEN and in use by other transactions, but a CLOSE request against the file has been received. Current® activity is allowed to complete, but no new activity is allowed to start.
This condition does not occur if the request is made to either a CLOSED, ENABLED file or a CLOSED, DISABLED file. In the first case, the file is opened as part of executing the request. In the second case, the DISABLED condition occurs.
Default action: Terminates the task abnormally.
- SYSIDERR
- Occurs
if a problem with the communications configuration prevents the REWRITE
from proceeding. For example:
- The connection that is named in the SYSID option is not the name of a Communications Definition (CD) entry.
- The SYSID option references a CD entry that is incorrectly configured.
- The SYSID option references a CD entry that is marked as out of service.
It can also occur if the connection to the remote system is closed. This could be because the remote system is not available.
Default action: Terminates the task abnormally.
