/sys$common/syshlp/helplib.hlb FORTRAN, Statements, REWRITE *Conan The Librarian (sorry for the slow response - running on an old VAX) |
Transfers data from internal storage and writes the data (translated if formatted; untranslated if unformatted) to the current record in the following types of files: an indexed, sequential (only if the current record and new record are the same length), or relative file. The current record is the last record accessed by a preceding, successful direct access, indexed, or sequential READ statement. Formatted REWRITE statement format: REWRITE ([UNIT=]u,[FMT=]f[,ERR=s][,IOSTAT=ios])[iolist] Translates the data from binary to character format as specified by FMT. Unformatted REWRITE statement format: REWRITE ([UNIT=]u[,ERR=s][,IOSTAT=ios])[iolist] Does not translate the binary data. Arguments: u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. f Is a format specifier. s Is the label of a statement to which control is transferred if an error condition occurs, prefaced by ERR=. ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT=. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. -------------------------------------------------------------- Formatted REWRITE Statement Behavior and Errors: The formatted REWRITE statement performs the following operations: o It retrieves binary values from internal storage. o It translates those values to character form as specified by FORMAT. o It writes the translated data to a current (existing) record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.) The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement. Errors occur under the following conditions: o If you attempt to rewrite more than one record in a single REWRITE statement operation o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with spaces.) o If the primary key value is changed In the following example, the REWRITE statement updates the current record contained in the relative organization file connected to logical unit 3 with the values represented by NAME, AGE, and BIRTH. REWRITE (3,10,ERR=99) NAME, AGE, BIRTH 10 FORMAT (A16,I2,A8) ------------------------------------------------------- Unformatted REWRITE Statement Behavior and Errors: The formatted REWRITE statement performs the following operations: o It retrieves binary values from internal storage. o It writes the untranslated data to a current (existing) existing record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.) The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement. Errors occur under the following conditions: o If you attempt to rewrite more than one record in a single REWRITE statement operation o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with zeros.) o If the primary key value is changed
|