PRINT



PRINT

     Prints the contents of a file.

SYNTAX


PRINT [[FILE=]filename]
[[;OUT=]outfile]
[[;START=]m]
[[;END=]n]
[[;PAGE=]p]
[;{UNN}]
{NUM}
[;NONUM]

PARAMETERS


filename Actual file name of the file to be printed. If you
do not specify a filename, the output is sent to
$STDLIST. The filename parameter may specify a
temporary or a permanent disk file. If the
filename begins with a dot (.) or slash (/),
it is assumed to be in the HFS syntax.

Note that there is no temporary domain for HFS
syntax files.

If you do not specify a file name, PRINT takes its
input from $STDINX and continues to do so until you
enter :EOD on a new line.

outfile Specifies a destination other than $STDLIST for
filename. If filename has embedded carriage control
characters (CCTL), then PRINT will insert a blank
in place of the CCTL in the outfile. New files are
created temporary (TEMP). File equations are ignored
unless an asterisk (*) precedes outfile, indicating
a backreference. You must use a file equation to
overwrite a permanent file. Since there is no
temporary domain for HFS syntax files, a
backreferenced file which finally resolves to an
HFS filename without the SAVE option results
in an error. You must use the SAVE option in
the file equation to overwrite a permanent file.

Note that if outfile is not interactive with the
user's $STDIN file, the PAGE parameter is ignored.

To redirect output to the line printer (dev=lp) you
could use the following commands:

file prt;dev=lp;cctl
print myfile;out=*prt

m Specifies the record number of the first file record
to be displayed. m is relative to 1 (one). If m is
a negative number, it specifies a record location
relative to the end-of-file, that is, -5 indicates
the fifth (5th) record from the end-of-file. Zero
(0) is an invalid specification. Default is the
first record of the file (1).

For byte stream files, the first line (or
"record") corresponds to the bytes from the
beginning of the file to the first new line
character, the second line contains bytes between
the first new line character and the second new
line character, and so on.

n Specifies the last record of the file to be
displayed. N is relative to 1 (one). If n is a
negative number, it specifies a location relative to
the end-of-file, that is, -5 indicates the fifth
(5th) record from the end-of-file. Zero (0) is an
invalid specification. Default is the last record of
the file.

p Specifies the number of lines to be displayed before
a page break occurs. Default is 23 lines for
interactive users and 0 (continuous) for non-
interactive users (that is, in a job). Specifying 0
for p suppresses page breaks in the output and
produces continuous output from the beginning to the
end of the file.

If filename contains more than p records and you are
working interactively, the command will display p
lines and then prompt you for a reply indicating
whether or not more output is desired. The prompt is:

(NEXT/EOF) CONTINUE?

where next is the next record number to be printed,
and EOF is the end-of-file value that would be
displayed by listf ,2. The range of valid
responses gives you considerable control over the output.

PRINT Command Control

Response Result

Y, Yes Continue printing at record next

N, NO, [Break] Stop printing

-m (integer) Continue printing at record next-m

+m (integer) Continue printing at record next+m

m (integer) Continue printing at record m

other, [Return] Continue printing at record next (default)

Responses are case insensitive. Note that [Return]
instructs PRINT to continue printing.

In jobs, the PAGE parameter is ignored and no prompt
for continuing output is generated. Instead, a page
eject control character is written to outfile every
p lines. A page value of 0 suppresses all page
breaks, and filename is printed from m through n,
inclusive. Zero is the default for jobs.

UNN Suppresses line numbering in the display, regardless
of whether the disk file is numbered or unnumbered.
UNN is the default.

NUM Specifies numbering of the lines as they are
displayed. The numbers will appear in front of the
line (record) being displayed. The number displayed
is the actual line number for numbered files; for
unnumbered files, relative numbering begins with one

NONUM Causes PRINT to not try to interpret filename as a
numbered file. This is useful when printing ASCII
data files with numeric data in the last eight
characters of every record.

OPERATION

     This command prints the contents of filename to the standard
     list device, unless another destination is specified with
     the outfile parameter.

     In a batch job, in which filename defaults to $STDINX,
     some MPE/iX commands, such as EOD, EOF, JOB, EOJ, and
     DATA, do not execute as part of the original job when they
     follow a PRINT command.  For example, if a JOB command
     follows a PRINT command, only those commands preceding
     PRINT are executed in the original job, and nothing is
     printed.  The JOB command following the PRINT command is
     taken as the start of a new job, which is then streamed as
     a new, second job.

NOTE

If an interactive user takes more than HPTIMEOUT minutes to respond to
the page number prompt, MPE/iX will terminate the CI. This can occur
only if HPTIMEOUT has been set to a positive value.

This command is available in a session, job, program or in
BREAK. Pressing [Break] aborts the execution of this command.

EXAMPLE(S)

     To send the contents of myfile to the line printer, enter the
     following commands:

     file xxx;dev=lp
     print myfile, *xxx

     In this example, the file xxx is equated with the line printer.
     Then the file myfile is "printed" to the file *xxx.  This is a
     case of a backreference to a backreference
     *xxx ---> lp ---> line printer.

     To create a User Command that prints the last 10 lines of
     a file use, EDIT/3000 to create the following Command
     File (called TAIL)

     parm file, last=10
     print !file; start = -!last

     The first line defines file as a required parameter of the
     command file and creates an optional parameter, last, the
     default value of which is 10.

     The second line instructs the PRINT command to print the
     dereferenced value of file (the value entered by the user).  The
     second line also tells the command to use the negative of the
     dereferenced value of last (10 by default) as the starting point
     for printing (that is, 10 records from the end).  Thus,

     tailb myfile

     would print the last 10 records of the file called myfile.

     Similarly,

     tailb myfile, 45

     would print the last 45 records of myfile, because entering
     the value 45 would override the default value of 10.

NOTE

The PRINT command itself can be used to create the same file:

     print $stdin,tailb
     parm file, last=10
     parm !file; start = -!last
     :eod
     save tailb

The SAVE command is used to make the file TAIL permanent, since the
default is a temporary file.

     The following command entry will print the last 10 records
     of the file called "posix/doc/print.doc" in the Current Working
     Directory (CWD).


     PRINT ./posix/doc/print.doc;start=-10