Device-Independent Programming

When a user may choose a device for I/O, GT.M routines can take one of two basic programming approaches.

The latter approach is called device-independent programming. To permit device independent programming, GT.M uses the same deviceparameter for all devices that have an equivalent facility, and ignores deviceparameters applied to a device that does not support that facility.

Example:

    OPEN dev:(EXCE=exc:REWIND:VARIABLE:NEWVERSION:WRITEONLY)
    

This OPENs a device with deviceparameters that affect different devices. Only the EXCEPTION has an effect for all device types. When dev is a terminal or a null device, GT.M ignores the other deviceparameters. When dev is an RMS file on disk, GT.M uses REWIND, VARIABLE, and NEWVERSION. When dev is a mailbox, GT.M only uses WRITEONLY. This command performs a valid OPEN for all the different device types.

[Note]

A file that has been previously created and contains data that should be retained can also be opened with the device parameter APPEND.