31.12.2013 Views

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

INPUT AND OUTPUT<br />

where:<br />

file variable<br />

integer expression<br />

specifies a file that is open for direct<br />

access. The file must have fixed-length<br />

records.<br />

specifies the positive integer<br />

expression indicating the component at<br />

which to position the file. The<br />

component number must not be less than<br />

or equal to zero.<br />

The FIND procedure allows you to directly access the components of a<br />

file. You can use the FIND procedure to move forward or backward in a<br />

file. The file must be open for direct access. That is, you must<br />

have specified DIRECT in the OPEN statement for that file. In<br />

addition, the file must have fixed-length records.<br />

After execution of the FIND procedure, the file is positioned at the<br />

specified component. The file buffer variable assumes the value of<br />

the component, for example:<br />

FIN D (A 1 b 1.1 III S, 4) ~<br />

As the result of this statement, the file position moves to the fourth<br />

component in the file Albums. The file buffer variable Albumsassumes<br />

the value of the fourth component.<br />

If you specify a component beyond the end of the file, no error<br />

occurs.<br />

You can use the FIND procedure only when reading a file. If the file<br />

is open for output (that is, with REWRITE), a call to FIND results in<br />

a run-time error.<br />

Example I<br />

BEGIN<br />

FIND (Albums, Current + 2);<br />

END;<br />

If the value of Current is 6, this statement causes the file position<br />

to move to the eighth component. The file buffer variable Albumsassumes<br />

the value of the component.<br />

Example 2<br />

BEGIN<br />

FIN D (A 1 b U IT! S, C U l'r e n t .. -1 ) ;<br />

END~<br />

If the value of Current is 6, this statement causes the file position<br />

to move backward one component to the fifth component.<br />

7-5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!