# Directives

LINE_SWITCH | Redirect Console Input/Output

## Formats

1. | Switch File (0): | LINE_SWITCH [(chan,ERR=stmtref)]
2. | Switch File (0): | LINE_SWITCH [device$]

Where:

chan | Channel or logical file number to which to redirect file 0 (zero) input and output.
device$ | Name of the device to which to switch file 0 (zero). String expression.
stmtref | Program line number or statement label to which to transfer control.

## Description

Use the LINE_SWITCH directive to switch all I/O currently sent to channel or logical file number 0 (zero, the terminal) to another device. Its primary purposes are to allow for secondary users on a PC or to provide remote maintenance capability.

While the LINE_SWITCH is in effect, the original device is disabled. PxPlus will expect to receive all input from and send all output to the new device designated as file or channel 0.

Use a LINE_SWITCH directive with no parameters to restore communications with the original device on channel (logical file number) 0 and CLOSE the alternate file.

## Example

line_switch "PORT2" ! Defines/opens PORT2 as logical file number (0)
line_switch ! Closes PORT2, restores terminal/console as logical file
#(0)