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 />

7.5 THE GET PROCEDURE<br />

The GET procedure reads the next component of a<br />

buffer variable.<br />

file into the file<br />

Fo rma t<br />

where:<br />

GET (file variab1e);<br />

file variable<br />

specifies the file to be read.<br />

Before you use the GET procedure to read one or more file components,<br />

you must have called the RESET procedure to prepare the file for<br />

reading (input). RESET moves the file position to the first component<br />

and assigns its value to the file buffer variable.<br />

As a result of the GET procedure, the file position moves to the next<br />

component of the file. The file buffer variable takes on the value of<br />

that component, for example:<br />

r;: [ ~:) E T (B() 0 k ~:; ) Y<br />

N P ItJ Y' pc: ::" li n 0 k ~:; ,., Y<br />

GET (Buoks);<br />

After execution of the RESET procedure, the file buffer variable<br />

Books A is set to the first component of the file. The assignment<br />

statement assigns this value to the variable Newrec. The GET<br />

proce~ure then assigns the value of the second component to Books A ,<br />

moving the file position to the second component. The next GET<br />

procedure moves the file position to the third component, as shown in<br />

Figure 7-1.<br />

B.,'""'", CT<br />

of File<br />

RESET GET<br />

(BOOKS) (BOOKS)<br />

• • t<br />

I<br />

RESET GET GET<br />

(BOOKS) (BOOKS) (BOOKS)<br />

FigurE~ 7-1: File position After GET<br />

I . . I EOF<br />

MR-S-3117-83<br />

By repeatedly using GET statements, you can read sequentially through<br />

the file.<br />

7-f)

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

Saved successfully!

Ooh no, something went wrong!