REWRITE


Update a written record in a file. REWRITE updates a record in a file on a local or a remote system. REWRITE command must always precede with a READ with the UPDATE option. Key field must not change in the record for VSAM datasets.

Syntax -


REWRITE Syntax

Parameters -


FILE(file-name) -

Specifies the file name to be accessed. If SYSID is specified, the data set is on a remote system irrespective of the name is defined to CICS.

If SYSID is not specified, the data set assumed to be on the local system. Otherwise, the resource definition is used to find out whether the data set is on a local or a remote system.

FROM(data-area) -

Specifies the data record that is to be written to the data set referred by the filename.

LENGTH(length-value) -

length-value is a halfword binary value. Specifies the data area (record) length that is to be written. This option is mandatory if SYSID is specified. If the file is on a remote system and SYSID is not specified, the LENGTH parameter should be set in the file resource definition.

If the file is on a local system, the LENGTH option must be specified for variable-length records but is optional for fixed-length records. However, it is advisable to specify the length of fixed-length records. If an incorrect length is specified for fixed-length records, a record of the fixed length is written and the LENGERR condition is raised.

If record length is bigger than specified, the record is truncated. If record length is smaller than specified, the record is padded with binary zeros.

NOSUSPEND -

Specifies the request does not wait if VSAM is holding an active lock against the record.

SYSID(system-name) -

Specifies the system name to which the request is directed. If SYSID specified and omit RBA, XRBA and RRN, LENGTH and KEYLENGTH must be specified.

TOKEN(data-area) -

data-value is a fullword binary value. Specifies a unique request identifier for a REWRITE used to associate it with a previous READ, READNEXT or READPREV command that specified UPDATE.

Error Conditions -


Below are the list of error conditions may occur in combination. If more than one occurs, only the first is passed to the application program.

Error ConditionRESP2, Description & SolutionSystem Action
14 DUPREC
150 - An attempt is to rewrite a record to a data set whose upgrade set has an alternate index with the UNIQUEKEY attribute, if the corresponding alternate key already exists in the alternate index.
Solution -This happens due to the rewriting records alternate key matches with another existing records alternative key. Debug the program logic to resolve the issue.
Task abnormally terminated
12 FILENOTFOUND
1 - A file name in the FILE option is not defined to CICS.
Solution -Contact support team to define the FILE in CICS region.
Task abnormally terminated
21 ILLOGIC
Any browse that is currently in progress is terminated when this condition is raised. 110 - VSAM error occurs that is not in one of the other CICS response categories.
Solution -This might be due to the non-sequence of file operations. Debug the program to correct the logic.
Task abnormally terminated
16 INVREQ
30 - REWRITE command is issued without a token and no previous READ for UPDATE can be found.
Solution -The previous READ for UPDATE not being found is that failed for some reason and the failure has not been correctly handled or has been ignored.

46 - Attempted to change the length of a BDAM variable length record or block.
Solution -Do not change length of the record after the READ with UPDATE. This might be a logic issue. Modify the program logic to resolve the issue.

47 - REWRITE instruction includes a token whose value cannot be matched against any token with an existing READ for UPDATE request.
Solution -READ with UPDATE or REWRITE tokens should match. This might be a logic issue. Modify the program logic to resolve the issue.

55 - NOSUSPEND is not allowed because the file is not a VSAM file accessed in RLS mode.
Solution -NOSUSPEND option is valid for only VSAM files accessed in RLS mode. Modify the program to remove NOSUSPEND option for files which are not accessing in RLS mode.
Task abnormally terminated
17 IOERR
120 - There is an I/O error during the file control operation.
Solution -An I/O error is any unusual event that is not covered by a CICS condition. For VSAM files, IOERR usually indicates a hardware error. For BDAM files, IOERR could means you are trying to write to a BDAM track address that is not defined for the data set.
Task abnormally terminated
54 ISCINVREQ
70 - The remote system indicates a failure that does not correspond to a known condition.
Solution -Contact remote system support team to resolve the issue.
Task abnormally terminated
22 LENGERR
10 - The LENGTH option is not specified or a file with variable-length records, or for a BDAM file with undefined format records.
Solution -Modify the program to specify the LENGTH option if not specified.For variable-length records, use the same length got while reading the record with READ UPDATE command.

12 - The length specified exceeds the maximum record size and the record is truncated.
Solution -The length of the record should not exceed maximum length. Use best possible solution to write the record without truncating.

14 - An incorrect length is specified for a file with fixed-length records.
Solution -Modify the program to specify the correct length to resolve the issue.
Task abnormally terminated
100 LOCKED
An attempt has been made to rewrite a record, but lock exists against the unique alternate key that is involved in the request.
Solution -The record might get locked for some other reason. Wait for some time and try again.
abend the task with code AEX8
18 NOSPACE
100 - No space is available on the direct access device for adding records to a data set.
Solution -Contact Storage support team to resolve the issue.
Task abnormally terminated
70 NOTAUTH
101 - A resource security check has failed on FILE(filename).
Solution -Contact system administrator team to check whether the appropriate access added for the user or group. It will resolve the problem.
Task abnormally terminated
19 NOTOPEN
60 - Below are the reasons for NOTOPEN
  • The requested file is CLOSED and UNENABLED.
    Solution -Open and enable the file using SET FILE or a CEMT SET FILE command. If no access, contact support team to enable the file.
  • The requested file is OPEN and in use by other transactions, but a CLOSE request against the file has been received.
    Solution -The CLOSE request might for using the file in batch environment. Wait for some time and try again later once the file enabled.
  • The requested file is CLOSED and ENABLED, so CICS has tried to open the file as part of executing the request.
    Solution -Open the file using SET FILE or a CEMT SET FILE command. If no access, contact support team to open the file.
Task abnormally terminated
101 RECORDBUSY
107 - NOSUSPEND is specified but VSAM holds an active lock against a unique alternate index key which would cause the request to wait.
Solution -This might occur very rarely. Wait for some time and try again.If this occurring on regular basis, modify the application program to remove NOSUSPEND.
Abend the task with code AEX9
53 SYSIDERR
130 - The SYSID name specified is neither the local region nor a remote system or the link to the remote system is closed.
Solution -The specified SYSID name is not related to any system. Correct it.If the link to the remote system is closed, that might be due to the remote system is not up and running. Contact remote system support team.
Task abnormally terminated