WEOF


 

The WEOF instruction establishes the End Of File (EOF) point at the position indicated. The instruction uses the following format:

 

 

[label]

WEOF

{file},{record}

 

Where:

label

Optional. A Program Execution Label.

file

Required. A previously defined and opened FILE variable in which the end of file position is updated.

record

Required. A previously defined Numeric Variable or Expression that selects the position for the end of file.

Flags Affected: NONE

Note the following:

  1. If {record} is zero (0) or greater, it indicates a random sector number. The End Of File (EOF) point is set at the beginning of the specified sector (see Random Access Method).

  2. If {record} is negative, the End Of File (EOF) point is set to the current position in the file.

  3. File space beyond the location of the EOF point is released to the system. If the new EOF is set before the current EOF, data beyond the new EOF is lost.

Example 1:

 

  

WEOF

DATAFILE,SEQ

 

Logical file:

DATAFILE

Method:

Sequential (SEQ is a previously defined negative numeric variable).

EOF Position:

End Of File (EOF) is set to the current file position.

 

Example 2:

 

  

WEOF

MYFILE,RECORD

 

Logical file:

MYFILE

Method:

Random (RECORD is a previously defined 0 or greater numeric variable).

EOF Position:

End Of File (EOF) is set to the beginning of the specified sector.

 

 

See Also: READ (FILE), WRITE (FILE), WRITAB (FILE), Disk I/O Instructions

 



PL/B Language Reference UPDATE, UPDATAB (IFILE) WRITAB