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

This example causes the system to interpret the first character of<br />

each line written to the predeclared file OUTPUT as a carriage control<br />

character. When you call OPEN for the predeclared file OUTPUT, you<br />

can specify only a carriage control option. If you include any other<br />

parameters, an error occurs.<br />

Example 4<br />

BEGIN<br />

[) PEN (A :I. b I..Im S 9 ,. P!:l : -::: ,J E N N J F E r~ :> I N V E N T I, 0 L.. D , , [I IRE C T ) ;<br />

END,<br />

The file variable albums will be associated with the file<br />

specification PS:(JENNIFER>INVENT. A RESET will initiate reading of<br />

the existing (OLD) file, or cause an error if the file does not exist.<br />

The file wil] be opened for direct access; that is you Cr.ln use the<br />

FIND procedure with this file. A REWRITE will ignore the OLD<br />

parameter.<br />

Example 5<br />

BEGIN<br />

OPEN (~;DlaT" 'Enpr'~J~:l:" NEWl' , FIXED);<br />

END;<br />

Assuming that Energy is defined as a logical name, this statement<br />

causes a RESET or REWRITE to create a file with the specification<br />

designated by the logical name Energy. The identifier Solar is used<br />

within the program to refer to the <strong>TOPS</strong>-<strong>20</strong> logical name. The file is<br />

created with fixed-length records. Default values are used for the<br />

record length and the record access parameters.<br />

Exampl e 6<br />

BEGIN<br />

OPEN (File_Name := 'PS:-:::SMITH:>PLAN.DAT',RECORD_TYPE != VARIABLE,<br />

File_Variable:=Plans);<br />

END,<br />

The file variable plans is associated with the file PLAN.DAT on PS:<br />

with a directory of . The file name and record type parameters<br />

use keywords. Because the file name keyword is used, each subsequent<br />

parameter must use a keyword. It is not necessary to indicate each<br />

unused parameter with a comma when keywords are used.<br />

7-.13

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

Saved successfully!

Ooh no, something went wrong!