FOR1100S
The REWRITE statement for unit unit-number, which was connected to file-name, failed. The key of reference had a value of new-rec-key (X'new-rec-key-hex'), which was different from orig-rec-key (X'orig-rec-key-hex'), the value of that key in the record that was read. The key of reference had a KEYID value of keyid. VS FORTRAN Version 2 Error Number: AFB139I

Explanation

You read a record and, in trying to rewrite it, provided a record in your output item with a key of reference whose value differed from that in the original record. You cannot use the REWRITE statement to replace a record if you change the value of the key of reference.

The term key of reference means the key (that is, certain positions within the record) that was used for the sequential or direct retrieval of the record that was read. The term keyid means the relative position of the start-end pair for this key within the start-end pairs listed in the KEYS specifier on the OPEN statement.

System action

If neither the ERR nor the IOSTAT specifier is present on the I/O statement, the condition is signaled. If the condition is unhandled, the application is terminated.

Qualifying Data: The basic set of four qualifying data for I/O conditions as shown in Table 1. Within this basic set, statement has a value of REWRITE, and parm_count has a value of 6. In addition, there are these qualifying data:

No. Name Input/ Output Data Type and Length Value
5 record-desc Input Q_DATA_DESC The q_data descriptor for record. It contains the data type and the length of record.
6 record Input CHARACTER*n The record. The length n is part of record-desc.
Name Action Taken after Resumption
RN The remainder of the input item list is ignored, and execution continues.

Programmer response

If you intended to replace an existing record rather than to write one with a modified key value, ensure that:
  • The value of the key in the output item list is the same as what was just read and that it is in the correct position in the record,
  • The output item list contains all the fields of the record to be rewritten, and
  • Any changes in the order or length of various fields in the record have not caused the value of the key of reference within the record to be shifted from its original position.
If you want to replace the record with one having a different key value, use the DELETE statement to delete the record that was read, and then
  • If there isn't already a record in the file with the different key value, then use the WRITE statement, rather than the REWRITE statement, to add the record with a new key value.
  • If there is already a record in the file with the different key value, then use the READ statement to read that record, and then use the REWRITE statement to replace that record.

If you want to add a new record with a key value that doesn't already exist in the file, then use the WRITE statement to add it.

Symbolic Feedback Code

FOR1100