As we saw in working with files it is usually possible to give a pseudodevice name such as
*SOURCE* instead of a filename. This post will go over what pseudodevices are available and also how redirection of command input/output works.
The following pseudodevices come as standard on the D6.0 distribution:
*MSOURCE*is the master source of input, either the keyboard for interactive sessions or the card reader for batch. It cannot be redefined.
*MSINK*is the master output destination, either the screen for interactive sessions or the printer for batch. It cannot be redefined either.
*SOURCE*is the current source of input, initially
*MSOURCE, and can be redefined.
*SINK*is the current output destination, initially
*MSINK, and can be redefined.
*DUMMY*is the empty device, similar to
*PUNCH*is the card punch device - on Hercules this is emulated by writing to a file. If output is sent to
*PUNCH*during an interactive session, a new batch job will be set up to do this.
*PRINT*is the print device. Again on Hercules this is emulated by writing to a file.
- Output to
*BATCH*creates a new batch job with the data sent used as the commands to execute.
*EXPORT*were used for BITNET connections and are not available on Hercules.
*TAPE9*are used as logical device names when mounting a tape on the emulated system.
You can also create your own pseudodevices using the MTS
You can use the MTS commands
$SINK to change the default input and output from
*MSINK*. In the below example I redirect output to the temporary file
-sinkfile and then run
$FILESTATUS. The output of the command is stored there and not displayed on screen. Finally I run
$SINK PREVIOUS to restore the output to
# sink -sinkfile # filestatus # sink previous # list -sinkfile 1 filestatus 2 ALPHA 3 BETA 4 sink previous
Logging input/output with
The MTS command
$LOG will create a copy of input/output.
# log -logfile # filestatus alp? ALPHA # log off Logging of *MSINK* on -LOGFILE terminated. # copy -logfile > $Log Output: REL., Job#=40, Host=MT, 22:16:47 Sun Jun 28/14 > #filestatus alpha > ALPHA > #log off
$DISPLAY LOGSTATUS command can be used to show what logging is currently in effect.
Logical I/O units
Logical I/O units provide a way for a program to access files without having to specify them in advance. For example, a program may read from logical I/O unit
SCARDS which you could define to be a file called
There is a common set of I/O units defined for each program, such as
SCARDS and also a free set of I/O units numbered 0-99. The common set of I/O units and their defaults are:
SCARDSis used for input and defaults to
SPRINTis used for printed output and defaults to
SPUNCHis used for output and defaults to
The example below shows the
*SORT command being run with input coming from the file
ALPHA and output going to
*SINK*, ie the screen. The
PAR= part of the command line is the parameters for the sort rather than an I/O device; here
CH,A means sort by characters ascending,
# list alpha 1 Line B 2 Line C 3 Line A # run *sort scards=alpha spunch=*sink* par=sort=ch,a # Execution begins 22:41:56 Line A Line B Line C Statistics: 3 input/ 0* intermediate files # Execution terminated 22:41:56 T=0.012
See MTS Volume 1 or the online help topics such as