OUT Command
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 12.2 OUT Command

This command takes a single ﬁle name as argument, and directs output to that ﬁle from then on, until another OUT changes the output ﬁle, or SHUT closes it. Output can go to only one ﬁle at a time, although many can be open. If the ﬁle has previously been used for output during the current job, and not SHUT, the new output is appended to the end of the ﬁle. Any existing ﬁle is erased before its ﬁrst use for output in a job, or if it had been SHUT before the new OUT.

To output on the terminal without closing the output ﬁle, the reserved ﬁle name T (for terminal) may be used. For example, out ofile; will direct output to the ﬁle OFILE and out t; will direct output to the user’s terminal.

The output sent to the ﬁle will be in the same form that it would have on the terminal. In particular x^2 would appear on two lines, an X on the lower line and a 2 on the line above. If the purpose of the output ﬁle is to save results to be read in later, this is not an appropriate form. We ﬁrst must turn oﬀ the NAT switch that speciﬁes that output should be in standard mathematical notation.

Example: To create a ﬁle ABCD from which it will be possible to read – using IN – the value of the expression XYZ:

off echo$ % needed if your input is from a file.
off nat$ % output in IN-readable form. Each expression
% printed will end with a $ .
out abcd$ % output to new file
linelength 72$ % for systems with fixed input line length.
xyz:=xyz; % will output "XYZ := " followed by the value
% of XYZ
write ";end"$ % standard for ending files for IN
shut abcd$ % save ABCD, return to terminal output
on nat$ % restore usual output form

Up | Next | Prev | PrevTail | Front