$PRINCIPAL (ObjectScript)
Contains the ID of the principal I/O device.
Synopsis
$PRINCIPAL
$P
Description
$PRINCIPAL contains the ID of the principal device for the current process. $PRINCIPAL operates like $IO. Refer to $IO for details of specific device types and system platforms.
If the principal device is closed, $PRINCIPAL does not change. If the principal input and output devices differ, $PRINCIPAL reflects the ID of the principal input device.
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.
Examples
This example uses $PRINCIPAL to test for a principal device.
IF $PIECE($PRINCIPAL,"|",4) {
WRITE "Principal device is: ",$PRINCIPAL }
ELSE { WRITE "Undefined" }
This example uses and writes to the principal device.
USE $PRINCIPAL
WRITE "output to $PRINCIPAL"
USE $PRINCIPAL and USE 0
The following statements are functionally equivalent:
USE $PRINCIPAL
USE 0
The first form is preferred because it is standard.