About I/O Devices
Caché 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 Caché. It includes the following topics:
Caché supports both physical and logical I/O devices. The supported physical devices include:
-
Terminals
-
Printers
-
Disk drives
-
Magnetic tape
-
Cartridge tape
The supported logical devices include:
-
Principal device
-
Spooler
-
Sequential files
-
Flat files
-
Interjob communication (IJC) devices
-
Routine interlock devices
Device Management Utilities
There are several Caché utilities to manage devices. The table below summarizes these utilities and alternative ways of accessing them.
Action | Utility | Description |
---|---|---|
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. At the Mag Tapes subsection, you associate magnetic tape device definitions (made in the Devices subsection) with the names of magnetic tape drives. |
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 Caché 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 Caché device mnemonic at a Device: prompt. The Caché 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”. |
Default Devices
Devices
When you install Caché, default devices are defined. These are displayed in the Devices configuration subsection of the Management Portal. Select System, Configuration, Device Settings, Devices. View the list of defined devices.
Device Subtypes
Caché 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, Configuration, Device Settings, SubTypes. View the list of defined sub types.
Magnetic Tape Devices
Caché also ships with some magnetic tape devices defined. The complete list of magnetic tape devices is in the Magnetic Tapes Devices configuration option of the Management Portal. Select System, Configuration, Device Settings, MagTapes. View the list of defined magnetic tape devices. Magnetic tape devices can be assigned device numbers 47 through 62; by default, magnetic tape devices are assigned to device numbers 47, 48, 57, and 58. (The magnetic tape devices are also listed in the Devices option.)
Identifying Devices
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.
Device Mnemonics
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.
Device IDs
You can identify devices by a number or by their operating system name. You use this identifier in OPEN commands.
Device Alias
You can define one or more alias values for each Caché device you define. When a user specifies an alias in an OPEN command, Caché translates it into the Device ID.
The default Device IDs that Caché provides are appropriate for most users. However, some users may want to override these defaults, particularly for magnetic tape devices. 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 Caché, these are the default device numbers and mnemonics for each type of device.
Device | Device ID | Mnemonic | Notes |
---|---|---|---|
Principal | 0 | TERM | You cannot change the Device ID for this device. |
Spooler | 2 | SPOOL | |
Magnetic Tape Drive | 47, 48 | 47, 48 | |
Cartridge Tape Drive | 57, 58 | 57, 58 |
Caché also supports device IDs 49-56 and 59-62, but does not initialize these IDs at installation. However, you can add device entries for these IDs, giving them the same value in the mnemonic field, if you have more magnetic tape and/or cartridge tape devices.
However, Caché also recognizes other device numbers that you can use to define devices. The following table lists the recognized default device numbers.
Device Number | Type | Definition |
---|---|---|
0 | Principal device | For an interactive process, this is the terminal on which the user logs in. For a Caché 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 | cconsole.log | Use this device number to send error messages or other special messages to the system console log. For example, issuing the following from a Terminal writes the specified string to the Console Log: OPEN 1 USE 1 WRITE "This is a test" CLOSE 1. See also the WriteToConsoleLog()Opens in a new tab method. |
2 | Caché system spooler | This is a global that stores output so you can direct it to a physical I/O device at another time. |
47-62* | Magnetic tapes | Up to 16 tape drives are supported. Only 4 magnetic tap device numbers, 47-48 and 57-58, are defined at installation. You can define the others if you have more than 4 magnetic tape devices. |
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 Caché processes. You can control the availability of these devices. See the section “Communication Between Caché 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.
Device Types
In addition to the mnemonics and device numbers, Caché supports I/O device types. Each internal device number belongs to one of these types. The following table shows the device types:
Type | Meaning |
---|---|
TRM | Terminal |
SPL | Spooling device |
MT | Magnetic tape drive |
BT | Cartridge Tape drive |
IPC | Interprocess communication device |
OTH | Any other device, such as a printer |
Defining Devices
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 Caché is running, you are prompted as to whether you want to activate the changes without restarting Caché. If you agree to activate the changes, the new definitions are made available immediately to users.
Managing Magnetic Tape Devices
Caché supports up to sixteen tape drives on each CPU. Any tape drive that your system supports can be used with Caché.
Defining Magnetic Tape Devices
Before you can use a magnetic tape device with Caché, you must define it in the MagTape configuration settings of the Management Portal. Take the following steps:
-
Select System, Configuration, Device Settings, MagTapes. View the current list of magnetic tape devices.
-
Click Create New Mag Tape.
-
Enter the name of the physical magnetic tape device (for example, \\.\TAPE1).
-
Enter a device number for the magnetic tape device (within the range 47 through 62).
-
Click Save to save the changes.
Deleting Outmoded Assignments
You should delete outmoded magnetic tape device definitions so that your users do not inadvertently select them.
Many magnetic tape utilities (including %GIF, %GOF, %RIMF, and %ROMF) ask you whether to wait 15 seconds if the utility is not able to open the magnetic tape or cartridge tape device. If you answer “Yes” or do not respond within 10 seconds, the utility lets you decide whether to continue waiting. If you choose not to wait, the system stops trying to open the device.
Accessing Devices
On a Caché for Windows system, you must use device numbers for magnetic tape devices, interjob communication devices, and routine interlock devices. For terminals and printers, you can use device mnemonics or device numbers you assign.
On a Caché for 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 SpacesMnemonic 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. 47, 48 Magnetic tape device 57, 58 Cartridge tape device -
Depending on the type of device, you see another prompt:
Device UtilitiesDevice 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. Magnetic Tape Parameters Rewind? A valid parameter list for an OPEN command for the device type. 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 at the Caché programmer prompt 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, Caché 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.
Level 3: Magnetic Tape Translation
If the device number is of class Mag Tape, the system checks the MagTape configuration settings of the Management Portal to see which physical tape drive device to access.
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:
WRITE /CHA(column)
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 Caché uses the default mnemonic space for the device type.
For further details on mnemonic spaces, see the.
Predefined Mnemonic Spaces
Caché ships with two predefined (default) mnemonic spaces, described in the following table:
Routine Name | Description |
---|---|
^%XMAG | Mnemonic space for magnetic tape. Default at startup for magnetic tape devices. |
^%X364 | Mnemonic space for X3.64 (ANSI) terminals. Default at startup for terminals, sequential files, and all other devices except magnetic tape. |
The predefined mnemonic spaces are the default mnemonic spaces for:
-
Sequential files (^%X364)
-
Magnetic Tape (^%XMAG)
-
Terminals (^%X364)
-
Other devices (^%X364)
These defaults are defined in the Management Portal. Select System, Configuration, Device Settings, IO Settings.
If you create your own mnemonic space routine(s), you may want to change the default mnemonic spaces Caché uses for one or more of the four device types.