REWRITE command in IBM - IBM Mainframe

The command will update a record in a file on either the local or remote system. Prior to execution of this command, the record must be read with the READ UPDATE command. When working with VSAM data sets, the key field in the record cannot change. The command may also be used to update a record in a CICS-maintained data table, and the update is made to both the source VSAM KSDS and the in-memory data table. The command structure for updating a CICS maintained table is the same as for a VSAM KSDS. The syntax of the REWRITE command is given below:

An example of REWRITE command is given below:

The various options are given below:

  • FILE (filename) - Contains the name of the user maintained file to be accessed. The FCT entry for the filename will determine where the location (local or remote) of the data set resides. However, when the SYSID option is used, the location of the filename is assumed to exist on a remote system regardless of what the entry has defined in the FCT if one exist on the local system
  • FROM (data_area) - Identifies the storage area containing the record to be written to a data set referred to by this file.
  • LENGTH (data_value) - Halfword binary (PIC 9(4) COMP) value containing the length of the record to be written to a file. This option is required for either a file defined as containing variable length records or if the SYSID option is used. This option is not necessary for fixed length records but is highly recommended because it will cause a check to be made on the length of the record against the record length in the file. The LENGERR condition occurs when the lengths are not equal.
  • SYSID (name) - Character field (4 bytes) specifying the name for the APPC connection to the required system. The name specified must be defined in the CICS terminal control table.
  • The handle conditions are given below:
  • DUPREC - This condition is set during the rewrite command because another record already exist with the same key and there is an alternate index with the UNIQUEKEY attribute specified for the file.
  • This is set when a file name specified in the FILE option of the command cannot be located in the FCT. The default action is abnormal termination of the task.
  • ILLOGIC (VSAM only) - Set when a VSAM error occurs which does not fall within one of the other CICS response categories. The default action is abnormal termination of the task.
  • INVREQ - Occurs for any of the following reasons:
    1. The command was issued when no prior successful READ UPDATE command was executed.
    2. The command when executed attempted to change the DBAM length for a variable length record or block.
  • The default action is the abnormal termination of the task.
  • IOERR - Set when an I/O error occurs during the READ. An I/O error can be any unusual event not covered by an existing CICS condition. For VSAM files, IOERR normally indicates a hardware error. The default action is the abnormal termination of the task.
  • ISCINVREQ -Set when the remote system indicates a failure that is not covered by an existing CICS condition. The default action is the abnormal termination of the task.
  • LENGERR - Can occur for any of the following reasons:
    1. A file containing variable-length records was accessed without the LENGTH option specified or a BDAM file was accessed with undefined format records.
    2. The length specified exceeds the maximum record size; the record is truncated.
    3. An incorrect length is specified for a file with fixed-length records.

The default action is the abnormal task termination.

  • NOSPACE - Condition is set when there is no more space on the storage device for adding the updated record to the file. The default action is the abnormal task termination.
  • NOTAUTH - Resource security check failure has occurred on FILE (filename). The default action is the abnormal task termination.
  • SYSIDERR - The SYSID specified cannot be found in the intersystem table,(defined in CICS by defining a CONNECTION), or if the link to the remote system is unavailable or closed. The default action is the abnormal task termination.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM Mainframe Topics