HP 3000 Manuals

REWRITE Statement (Executable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

REWRITE Statement (Executable) 

The REWRITE statement is used to update existing records in an ISAM file.
The record being updated is the most recent record read from the file by
a READ statement.  REWRITE unlocks the record if it is locked.

[]
---------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ---------------------------------------------------------------------------------------------- | | | | | unit | Integer expression | Must be zero or positive. | | | specifying the unit number | | | | of a file. | | | | | | ---------------------------------------------------------------------------------------------- | | | | | address | Integer expression. | None. | | | | | ---------------------------------------------------------------------------------------------- | | | | | char_variable | Internal file written. | Character variable or scalar | | | | record field. | | | | | ---------------------------------------------------------------------------------------------- | | | | | char_array_element | Internal file written. | Character array element or | | | | scalar record field. | | | | | ---------------------------------------------------------------------------------------------- | | | | | char_substring | Internal file written. | Character substring. | | | | | ---------------------------------------------------------------------------------------------- | | | | | integer_expression | Integer expression | Must be zero or positive. | | | specifying the unit number | | | | of an internal file. | | | | | | ---------------------------------------------------------------------------------------------- | | | | | fmt | Format designator. | fmt must be as specified in | | | | a PRINT statement. | | | | | ---------------------------------------------------------------------------------------------- | | | | | namelist_group_name | Symbolic name specifying a | Cannot appear in a statement | | | list of variables or arrays | containing a format | | | previously declared in a | specifier. | | | NAMELIST statement. | | | | | | ---------------------------------------------------------------------------------------------- | | | | | ios | Integer variable or array | Must be an integer type. | | | element for error return. | | | | | | ---------------------------------------------------------------------------------------------- | | | | | label | Statement label of an | Must be the label of a | | | executable statement. | statement in the same | | | | program unit. | | | | | ---------------------------------------------------------------------------------------------- Semantics A REWRITE statement must contain a unit number and at most one of each of the other options. If the prefix UNIT= is omitted, unit must be the first item in the list. This is the unit number for the output device or file. If the prefix FMT= is omitted, fmt must be the second item in the list and the unit (without a prefix) must be the first item. If fmt is not present and a namelist group name is not specified, the write is unformatted (binary). record_name and aggregate variables can only be used in unformatted writes. If the IOSTAT specifier is present and an error occurs, the error code is returned in the IOSTAT variable and the program is not aborted. Refer to Appendix A for the IOSTAT error codes. If the ERR specifier is present and an error occurs during execution of the REWRITE statement, control transfers to the specified statement rather than aborting the program. Examples Notes --------------------------------------------------------------------------------------- READ (10,KEY='111-22-333',ERR=555) Updates a record. It reads the record, +EMPLOYEE_REC changes the fields, and then updates the EMPLYEE_REC.BONUS = record by using REWRITE. +EMPLOYEE_REC.SALARY * 0.1 REWRITE(10,ERR=556,IOSTAT=I) +EMPLOYEE_REC


MPE/iX 5.0 Documentation