Skip to main content

Overview of I/O Commands

Overview of I/O Commands

The I/O commands allow you to own, use, read from, write to, and close devices. To direct I/O operations to a device, first issue the following commands:

  • Issue an OPEN command to establish ownership, unless the device is your principal device.

  • Issue a USE command to make the device the current device.

  • Subsequent READ and WRITE commands read from and write to that device.

  • A CLOSE command releases ownership of the device so that other processes can use the device.

The following general syntax applies to I/O commands that support I/O command keywords in ObjectScript:

OPEN device:paramlist:timeout:"mnespace"
USE device:paramlist:"mnespace"
CLOSE device:paramlist

where paramlist is either a single parameter, or a list of parameters enclosed in parentheses and separated by colons:

 parameter  (parameter:parameter[:...]) 

A parameter can either be a positional parameter or a keyword parameter. A keyword parameter has the following syntax:

/keyword[=value] 

The leading slash distinguishes a keyword parameter from a positional parameter value. The meaning of a positional parameter value is derived from its position in the colon-delimited list. The meaning of a keyword parameter value is derived from the specified keyword.

Note that both positional and keyword parameters can be specified in the same paramlist. For example, the following example mixes positional and keyword parameters to open a new file named test.dat in write/sequential mode with JIS I/O translation:

   OPEN "test.dat":("NWS":/IOTABLE="JIS")
FeedbackOpens in a new tab