When multiple processes access a file through the same logical file, file attribute changes made by any one process are visible to all the other processes. This visibility holds true regardless of whether a process assigned a file attribute explicitly, or performed some other action that implicitly caused the file attribute value to change. Therefore, when you design processes to read or write the attributes of a shared file, you must be aware of the timing considerations previously discussed under Synchronizing Access with Shared Logical Files in this section.
For example, suppose a process performs a read operation through a shared logical file, and then immediately interrogates attributes such as STATE, LASTRECORD, or CURRENTRECORDLENGTH. These attributes do not necessarily return the values established by the preceding read statement, because another process might have executed an I/O operation in between the read statement and the file attribute interrogations performed by this process. You can prevent this problem in either of the following ways:
-
By designing an I/O statement to directly return the information you need, so that the process does not have to interrogate file attributes to determine the result of the statement. For example, you could use a statement like the following:
B := READ (PORTF [SUBFILE INX:0], 72, IOBUF)
If this statement is used, the process can use the value stored in B instead of interrogating the STATE attribute, and can use the value stored in INX instead of interrogating the LASTSUBFILE attribute. The process could also read the current record length from field [47:20] of B, instead of interrogating the CURRENTRECORDLENGTH attribute.
-
By designing your application so that no process performs an I/O operation on a file while another process is interrogating the attributes of that file.

