InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference

ObjectScript Reference
Previous section           Next section
InterSystems: The power behind what matters   

Contains the ID of the principal I/O device.
$PRINCIPAL contains the ID of the principal I/O 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.
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.
   WRITE "output to $PRINCIPAL"
$PRINCIPAL is functionally equivalent to the widely used, but nonstandard, USE 0. Use $PRINCIPAL instead of USE 0 because it is standard, and because it makes your code more flexible.
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-16 05:50:13