Reporting Results [ Command Interpreter Access and Variables Programmer's Guide ] MPE/iX 5.0 Documentation
Command Interpreter Access and Variables Programmer's Guide
Reporting Results
Usually, output from a command file or UDC is displayed on the user's
terminal. The ECHO command and, in some situations, the PRINT command
display output from a command file or UDC to the terminal. In some
instances, output can be used as input for a subsequent procedure. This
is easily accomplished by redirecting output from a command file or a UDC
to a file.
Displaying Output to the Terminal
The ECHO command displays information to the user's terminal. All text
following the command name is displayed. Variables and expressions can
be dereferenced to insert their values or results in the display.
ECHO FOR FILE !FILE:
ECHO RECSIZE: ![FINFO(FILE,14)], EOF: &
![FINFO(FILE,19)], FLIMIT: ![FINFO(FILE,12)].
The dereferenced values are substituted into the string to be displayed
on the user's terminal. The following example shows the result of this
ECHO command for the file A.PUB.SYS.
FOR FILE A.PUB.SYS:
RECSIZE: -80, EOF: 5, FLIMIT: 5.
The PRINT command accepts the MPE escape syntax that permits you to
access HFS (hierarchical file system) files and directories. Refer
to New Features of MPE/iX: Using The Hierarchical File System
(32650-90351).
Redirecting Output to a File
By using redirection indicators, most CI statements can send output to a
file rather than display it on the user's terminal. A redirection
specification for an output file is added to the appropriate statement.
The name of the file to receive the output is preceded by the redirection
indicator (either > or >>). Only a single file name can be specified for
a single output redirection specification; wildcard characters,
therefore, cause errors. The following example shows how the output of
the SHOWCATALOG command is sent to the file UDCNAMES.
:SHOWCATALOG >UDCNAMES
In the previous example, the redirection indicator, >, creates a new,
temporary file to which the SHOWCATALOG output is sent. The file is
created with the following default characteristics:
* 80-byte, variable length, ASCII records.
* DISC=10000.
* TEMP file.
* NOCCTL.
The file is created with write, shared, and multiaccess. These default
values can be overridden by using a backreference to a file equation.
Note that if the file exists and the output redirection indicator is >,
the output from the statement overwrites any existing data in the file.
To open an existing file and append new output, the output redirection
indicator is >>. The following example creates a file for the SHOWME
command output. It then appends output from the SHOWOUT command to the
same file.
:PURGE ABC
:SHOWME >ABC
:SHOWOUT >>ABC
In this example, the file ABC is created, and the SHOWME output is
written to it. The file is then closed. It is reopened for append
access to receive output from the SHOWOUT command.
Output redirection works differently if the output destination is a
device file, such as a spoolfile or tape file. The same commands as in
the previous example are sent to a spoolfile in the following example:
:FILE lp602;DEV=EPOC;ENV=lp602.hpenv.sys
:SHOWME >*lp602
:SHOWOUT >>*lp602
As with the prior example, the spoolfile is created based on
specifications in the file equation, and the output from the SHOWME
command is written to it. The spoolfile is then closed and becomes ready
to print. A second spoolfile is created for the SHOWOUT command output
and is opened with append access. A spoolfile is completed and ready to
print when it is closed; it cannot be reopened. The append access of the
SHOWOUT command is unnecessary in this case.
MPE/iX 5.0 Documentation