Contains the ID of the current input/output device.
$IO contains the device ID of the current device to which all input/output operations are directed. If the input and output devices are different, $IO contains the ID of the current input device.
InterSystems IRIS sets the value of $IO to the principal input/output device at login. $PRINCIPAL contains the ID of the principal device. You issue a USE command to change the current device. Only the USE and CLOSE commands, a BREAK command, or a return to the Terminal can change this value.
You can return the device type of the current device by using the GetType()Opens in a new tab method of the %Library.DeviceOpens in a new tab class.
On UNIX® systems, $IO contains the actual device name.
On Windows systems, $IO contains an InterSystems IRIS-generated unique identifier for the principal device. For terminal devices (TRM or TNT), this consists of a pseudo-device name enclosed in vertical bars, a colon and another vertical bar, followed by the device’s process ID (pid) number. For non-terminal devices, the pseudo-device name is enclosed in vertical bars and followed by a unique numeric identifier.
For a Terminal: |TRM|:|pid
For a Telnet terminal: |TNT|nodename:portnumber|pid
For a file descriptor: |FD|file_descriptor_number
(File descriptors are used with CALLIN/CALLOUT remote access.)
For a TCP device: |TCP|unique_device_identifier
For a named pipe: |NPIPE|unique_device_identifier
For the default printer: |PRN|
For a printer other than the default: |PRN|physical_device_name
If the principal device is a null device (which is the default for a background process), $IO contains the null device name with ":pid" appended, thus allowing you to use $IO for a unique subscript. The null device name contained in $IO depends on the operating system.
For Windows systems, $IO contains //./nul:pid
For UNIX® systems, $IO contains /dev/null:pid
If the input device is redirected via a pipe or file, $IO contains “00”.
The default device number for a device is configurable. Go to the Management Portal, select System Administration, Configuration, Device Settings, Devices. For the desired device, click “Edit” to display and modify its Physical Device Name: option. If you do this, $IO will contain the assigned device number, rather than the actual operating system device name.
This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.