PRINT [ MPE/iX Commands Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Commands Reference Manual Volume I
PRINT
Prints the contents of a file.
Syntax
PRINT[[FILE=]filename] [[;OUT=]outfile] [[;START=]m] [[;END=] n ]
[[;PAGE=]p][;{UNN}]
[ {NUM}]
Parameters
filename Actual file name of the file to be printed to
$STDLIST, unless outfile is specified as a
destination. To specify an HFS file, begin the
filename with a dot (.) or slash (/). For MPE/iX
files, filename may specify either a temporary or a
permanent disk file. There is no temporary domain
for HFS syntax files.
File equations are ignored unless an asterisk (*)
precedes filename, indicating a backreference.
The filename may be $STDIN or $STDINX.
If you do not specify a file name, PRINT takes its
input from $STDINX and continues to do so until you
enter the :EOD command on a new line.
outfile Specifies a destination other than $STDLIST
for filename. If filename has embedded
carriage-control characters (CCTL), PRINT inserts a
blank in place of the CCTL in the outfile. New
files are created 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 that finally resolves
to an HFS file name without the ;SAVE option
results in an error. You must use the ;SAVE option
in the file equation to overwrite a permanent file.
If outfile is not interactive with the user's
$STDIN file, the PAGE parameter is ignored. (Refer
to the FRELATE intrinsic for additional information
on "interactive pair" of files.)
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. An m is relative to 1. If
m is a negative number, it specifies a record
location relative to the end-of-file, that is, -5
indicates the fifth record from the end-of-file.
Zero is an invalid specification. Default is the
first record of the file.
For byte-stream files, the first line (or "record")
corresponds to the bytes from the beginning of the
file to the first newline character, the second
line contains bytes between the first newline
character and the second newline character, and so
on.
n Specifies the last record of the file to be
displayed. An n is relative to 1. If n is a
negative number, it specifies a location relative
to the end-of-file, that is, -5 indicates the fifth
record from the end-of-file. Zero is an invalid
specification. Default is the last record of the
file.
__________________________________________________
NOTE For byte stream files, you cannot display one
or more records by specifying a negative
number with the keywords START= or END=. If
you try to do so, the result will be
unpredictable because the end-of-file for
byte stream files is the total byte count of
the file, and not the number of the last
record.
__________________________________________________
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 displays p
lines and then prompts you for a reply indicating
whether or not more output is desired, as follows:
(NEXT/EOF) CONTINUE?
NEXT is the next record number to be printed, and
EOF is the end-of-file value that would be
displayed by LISTF <filename>,2. If you are
reviewing a byte-stream file, NEXT displays the
next logical record, whereas EOF is the byte count
of the file.
Table 2-23 defines the range of valid responses
to control the output.
Table 2-23. 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, no prompt for continuing output is
generated. Instead, a page-eject control character
is written to outfile every p lines. A page value
of zero suppresses all page breaks, and filename is
printed from m through n, inclusive. This 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 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 1.
Operation Notes
This command prints the contents of filename to the standard list device,
unless another destination is specified with the outfile variable.
If an interactive user takes more than HPTIMEOUT minutes to respond to
the page number prompt, MPE/iX terminates the CI. This occurs only if
HPTIMEOUT has been set to a positive value.
In a batch job, in which the 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 second job.
Use
This command is available in a session, job, program, or in BREAK.
Pressing Break aborts the execution of this command.
Examples
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.
Use EDIT/V to create the command file TAIL which prints the last 10 lines
of a file:
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).
To print the last 10 records of the file called MYFILE, enter:
TAIL MYFILE
To print the last 45 records of MYFILE, because entering the value 45
overrides the default value of 10, enter:
TAIL MYFILE, 45
NOTE The PRINT command itself can be used to create a file:
PRINT $STDIN,TAILB
PARM FILE, LAST=5
PRINT !FILE; START = -!LAST
:EOD
SAVE TAILB
The SAVE command is used to make the file TAILB permanent since the
default is temporary.
HFS Example
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
Related Information
Commands FCOPY, COPY
Manuals None
MPE/iX 5.0 Documentation