About I/O Devices
InterSystems IRIS® data platform provides support for many different kinds of devices, both physical devices and logical devices. This book describes how to manage:
Because I/O interfaces are often platform-dependent, several chapters in this manual have separate sections for managing an I/O device on different operating system platforms.
This chapter introduces topics related to managing I/O devices in InterSystems IRIS. It includes the following topics:
InterSystems IRIS supports both physical and logical I/O devices. The supported physical devices include:
The supported logical devices include:
Interjob communication (IJC) devices
Routine interlock devices
Device Management Utilities
There are several ObjectScript utilities to manage devices. The table below summarizes these utilities and alternative ways of accessing them.
|Define devices||Device configuration in the Management Portal||Allows you to define devices users can access with the %IS utility. The devices are stored in the %IS global. You can edit and delete these device definitions. At the Devices subsection, you define devices, including mnemonics and aliases. Default devices are provided. In the Device Sub-Types subsection, you define device subtypes. Default subtypes are provided.|
|Define default mnemonic spaces||IO configuration options in the Management Portal||You can control devices with the WRITE /mnemonic command. On this panel, you enter the name of the default mnemonic spaces that InterSystems IRIS uses when executing a WRITE /mnemonic command that wasn't preceded by an OPEN or USE command with a mnemonic space specification argument.|
|Allow users to select a device interactively in character-based applications.||%IS||Programmers call this utility in character-based applications to allow users to select a device by specifying its InterSystems IRIS device mnemonic at a Device: prompt. The InterSystems IRIS device and its mnemonic must be configured using the Devices options from the Management Portal.|
|Allow users to store print output in a spool file||%SPOOL||For more information, see the chapter “SPOOL Device”.|
When you install InterSystems IRIS, default devices are defined. These are displayed in the Devices configuration subsection of the Management Portal. Select System Administration, Configuration, Device Settings, Devices. View the list of defined devices.
InterSystems IRIS ships with many default device subtypes. Each device subtype defines device characteristics, such as screen length and form-feed characteristics.
The complete list of subtypes is in the Device Subtypes configuration option of the Management Portal. Select System Administration, Configuration, Device Settings, Device Subtypes. View the list of defined subtypes.
When you define a device in the Devices configuration section of the Management Portal, you provide three device identifiers to specify a device:
Mnemonic, which is used at the %IS Device prompt.
Device ID, which is used in an OPEN command.
Alias, which can be used in place of a Device ID in an OPEN command.
These device identifiers have several advantages over physical device names:
They uniquely identify logical devices regardless of how many physical devices you have.
They assign different characteristics to each logical device.
They allow user applications to reference devices by consistent numbers without having to know the actual physical device names, which may vary on different platforms.
For more information about using device identifiers, see the Accessing Devices section.
You can associate one or more mnemonics with a particular Device. You use a mnemonic in response to the “Device:” prompt issued by the %IS character-based utility.
Mnemonics provide these advantages:
They are flexible, because you can change where the mnemonic points rather than developers having to change their applications.
They are easy for users and developers to remember. For instance, you can set up a printer device with the mnemonic Printer, or you can set up a Device ID for a file name and give it the mnemonic FILE.
You can identify devices by a number or by their operating system name. You use this identifier in OPEN commands.
You can define one or more alias values for each InterSystems IRIS device you define. When a user specifies an alias in an OPEN command, InterSystems IRIS translates it into the Device ID.
The default Device IDs that InterSystems IRIS provides are appropriate for most users. However, some users may want to override these defaults. You can do this by providing an alias as part of the device's configuration settings in the Management Portal.
Default Device IDs and Mnemonics
When you install InterSystems IRIS, these are the default device numbers and mnemonics for each type of device.
|Principal||0||TERM||You cannot change the Device ID for this device.|
However, InterSystems IRIS also recognizes other device numbers that you can use to define devices. The following table lists the recognized default device numbers.
|0||Principal device||For an interactive process, this is the terminal on which the user logs in. For an InterSystems IRIS jobbed process, this is the null device (by default) or the device provided in the argument list for the job command which creates the jobbed process.|
|1||messages.log||Use this device number to send error messages or other special messages to the system messages log. For example, issuing the following from a Terminal writes the specified string to the messages log: OPEN 1 USE 1 WRITE "This is a test" CLOSE 1. See also the WriteToConsoleLog()Opens in a new window method.|
|2||InterSystems IRIS system spooler||This is a global that stores output so you can direct it to a physical I/O device at another time.|
|63||View buffer||Used with the VIEW command and $VIEW function to transfer data between memory and disk.|
|20-46, 200-223||Routine interlock devices||Provided for compatibility with DSM locking applications.|
|4-19, 64-199, 224-255, 2048-2375||IJC devices||Interjob communication (IJC) logical devices. Used to transfer information between InterSystems IRIS processes. You can control the availability of these devices. See the section “Communication Between InterSystems IRIS Processes” for more information.|
|None||The Null device||/dev/null: the Null device on NL: the Null device on Used to dispose of output you do not want displayed.|
|256-2047||Terminals, printers, and flat files.|
* Device 50 has a hardcoded blocksize of 2048.
In addition to the mnemonics and device numbers, InterSystems IRIS supports I/O device types. Each internal device number belongs to one of these types. The following table shows the device types:
|IPC||Interprocess communication device|
|OTH||Any other device, such as a printer|
You define, edit, and delete devices in the Devices configuration settings of the Management Portal. The information you enter is stored in the ^%IS global. For more information about this global, see the section Structure of ^%IS Global.
If you make device changes while InterSystems IRIS is running, you are prompted as to whether you want to activate the changes without restarting InterSystems IRIS. If you agree to activate the changes, the new definitions are made available immediately to users.
On a Windows system, you must use device numbers for interjob communication devices, and routine interlock devices. For terminals and printers, you can use device mnemonics or device numbers you assign.
On a UNIX® system, you can use UNIX® file specifications to refer to files or you can set up device numbers to refer to files.
You can access a device in one of two ways:
Entering a device mnemonic at the “Device:” prompt in the %IS utility.
Issuing an OPEN command and entering a Device ID or Alias.
Allowing Users to Select Devices with the %IS Utility
If you want users of a character-based application to select a device interactively, call the %IS utility from the application. You can learn more about the %IS utility in the section Allowing Users to Specify a Device.
To select a device using the %IS utility:
At the Device: prompt, enter a device mnemonic.Predefined Mnemonic Spaces
Mnemonic Corresponding Device <ENTER> Terminal screen SPOOL Spooler 2 Spooler |PRN| Default Windows Printer File name: MYFILE.TXT DEV$:[TEST]MYFILE.TXT C:\MGR\MYFILE.TXT File at path specified or, if no path specification, in current directory.
Depending on the type of device, you see another prompt:Device Utilities
Device Prompt Valid Responses Terminal Right Margin A number representing the number of characters per line. Printer Right Margin A number representing the number of characters per line. Spooler Name (of file) A valid file name for the platform, path optional. File Name Parameters A valid parameter list for an OPEN command for the device type.
Accessing Devices with the OPEN Command
You can use an OPEN command either in the Terminal or within an ObjectScript application to open a specific device for reading and writing. When you specify the device, you can use its Device ID or its alias.
Interpretation Levels for Devices
Device identifiers you use with %IS or an OPEN command go through up to three levels of interpretation. Thus, if you enter the mnemonic 47 at the %IS global “Device:” prompt, the final device ID that is used may be different. The three levels are described below.
Level 1: %IS Utility Level
The first level is used if a device is selected with the %IS utility. Mnemonics in the ^%IS global can be associated with device numbers. The %IS utility then issues an OPEN command to that device number.
Level 2: OPEN Command Level
In an OPEN command, InterSystems IRIS checks to see if this number exists in the Alias column of the Device panel table. If so, it translates it to the actual device number or name for that device.
Be sure not to define an alias that matches a Device ID but is associated with a different device if you want to access that device by its mnemonic from ^%IS.
Defining Default Mnemonic Spaces
Programmers can control devices by using WRITE /mnemonic commands in their applications. For instance, programmers can move the cursor to a specific column in the current line on a terminal device when they use the %X364 mnemonic space with this command:
The action caused by any particular value of mnemonic is determined by the mnemonic space the WRITE command is using. A mnemonic space is a routine with entry points (mnemonics) that define device actions and attributes.
The WRITE command uses the mnemonic space defined in the OPEN or USE command for the device. If the OPEN or USE command includes no mnemonic space argument, then InterSystems IRIS uses the default mnemonic space for the device type.
For further details on mnemonic spaces, see the.
Predefined Mnemonic Spaces
InterSystems IRIS ships with the predefined (default) mnemonic space ^%X364. This is the default mnemonic space for X3.64 (ANSI) terminals. It is the default at startup for terminals, sequential files, and other devices.
These defaults are defined in the Management Portal. Select System Administration, Configuration, Device Settings, IO Settings.
If you create your own mnemonic space routine(s), you may want to change the default mnemonic spaces InterSystems IRIS uses for one or more of these device types.