J3/98-211 Date: 23 Oct 1998 To: J3 From: R. Maine Subject: Edits for positioning stream I/O This paper proposes additional edits for B.4, stream I/O. Specs and syntax were proposed in paper J3/98-209. Edits for sequential stream I/O were proposed in paper J3/98-210. The current paper builds on the edits for the sequential case and adds support for random positioning. These edits are all relative to J3/98-007R3 except where stated otherwise. A few of them modify edits proposed in J3/98-210. [155:15+] In the paragraph added by J3/98-210 change "values" to "file storage units" 3 times. [155:38] "processor-dependent" -> "file storage (9.2.1.4)" [158:8+] In the section added by J3/98-210, change the first 2 occurances of "values" to "file storage units". [158:8+] Change item (2) of the text inserted by J3/98-210 to be 2 items, "(2) Each file storage unit in the file is uniquely identified by a positive integer called the position. The order of the file storage units in the file is the order of their positions. (3) File storage units need not be read or written in order of their position. For example, it is permissable to write the file storage unit at position 3, even though the file storage units at positions 1 and 2 have not been written. Any file storage unit may be read from the file while it is connected to a unit, provided that the file storage unit has been written since the file was created. [158:12-14] Replace the 3 occurances of "values" added in J3/98-210 by "file storage units". [158:25+] Add a para "In a file connected for stream access, the file position is either between two file storage units, at the initial point of the file, at the terminal point of the file, or undefined." [159:4+] Replace the para added in J3/98-210 with "For stream access, the file is positioned immediately before the file storage unit specified by the POS= specifier; if there is no POS= specifier, the file position is not changed." [159:14+] Add new section "9.2.1.4 File storage units [Add file storage unit to the index pointing here] A <> is the basic unit of storage in an unformatted file. It is the unit of file position in stream access, the unit of record length in unformatted direct access, and the unit of file size for all external files. Every value in an unformatted file shall occupy an integer number of file storage units, which shall be the same for all scalar values of the same type and type parameters. The number of file storage units required for an item of a given type may be determined using the IOLENGTH= specifier of the INQUIRE statement (9.7.3). In a file connected for stream access, the processor shall not have alignment restrictions that prevent a value of any type and type parameters from being stored at any positive integer file position. It is recommended that the file storage unit be an 8-bit octet where this choice is practical. [BEGIN NOTE] The requirement that every data value occupy an integer number of file storage units implies that data items inherently smaller than a file storage unit will require padding. This suggests that the file storage unit be small to avoid wasted space. Ideally, the file storage unit would be choosen such that padding is never required. A file storage unit of one bit would always meet this goal, but would likely be impractical because of the alignment requirements. The prohibition on alignment restrictions prohibits the processor from requiring file data alignments larger than the file storage unit. The 8-bit octet is recommended as a good compromise that is small enough to accomodate the requirements of many applications, yet not so small that the data alignment requirements are likely to cause significant performance problems. [END NOTE] [160:4] Delete "that do not specify namelist formatting" [164:5] "processor-dependent" -> "file storage" [167:29+] Add new line "<> POS = " [168:11] Change "or a " to "or a POS= specifier". [168:25+] Add new constraint "Constraint: If a POS= specifier is present, the shall not contain a , , or REC= specifier." [169:24+] Add new section "9.4.1.4 File position The POS= specifier specifies a file position in file storage units. This specifier may be present only in an input/output statement that specifies a unit connected for stream access. A processor may prohibit the use of POS= with particular files that do not have the properties necessary to support random positioing. A processor may also prohibit positioning a particular file to anywhere prior to its current file position if the file does not have the properties necessary to support such positioning. [BEGIN NOTE] A file that represents connection to a device or data stream might not be positionable. [END NOTE]" [171:28] Replace the "values" added in J3/98-210 by "file storage units". [179:3+] In the new section added by J3/98-210, add the following after the 2nd para. "A value in the file is stored in a contiguous sequence of file storage units, begining with the file storage unit immediately following the current file position. After each value is transfered, the current file position is moved to the point immediately after the last file storage unit of the value." [186:16+] In the paragraph added by J3/98-210 change "values" to "file storage units" 2 times. [187:29+] Add new lines "<> POS = <> SIZE = " [189:32] "processor-dependent" -> "file storage" [189:42+] Add new sections "9.7.1.15 POS= specifier in the INQUIRE statement The in the POS= specifier is assigned the number of the file storage unit immediately following the current position of a file connected for stream access. If the file is positioned at its terminal position the variable is assigned a value one greater than the number of the last storage unit in the file. If the file is not connected for stream access or if the position of the file is indeterminate because of previous error conditions, the variable becomes undefined. 9.7.1.16 SIZE= specifier in the INQUIRE statement The in the SIZE= specifier is assigned the size of the file in file storage units. If the file size cannot be determined the variable is assigned the value -1. For a file that may be connected for stream access, the file size is the number of the last file storage unit in the file. For a file that may be connected for sequential or direct access, the file size may be greater than the number of storage units implied by the data in the records; the exact relatiosnhip is processor-dependent." [192:35] Replace "value...statement" with "number of file storage units that would be required to store the data of the output list in an unformatted file." The above statement didn't make sense before anyway. It was an awkward attempt to work around the lack of a term for "file storage unit". The only sensible interpretation I could make of "value that would result..." was the value of the actual data; I certainly didn't see anything about length or size in the old definition. Luckily the specifier name gives a hint, and the requirement that it be useable as a RECL is pretty explicit. But these didn't adequately make up for a nonsensical definition. [329:23] "or" -> "a file storage unit (9.2.1.4), or" [363:14+] Add glossary entry "<> (9.2.1.4) : The basic unit of storage in an unformatted file." [367:20] "or" -> "a , or"