Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see the InterSystems IRIS Migration Guide and Migrating to InterSystems IRIS, both available on the WRC Distributions page (login required).

$ZMODE

Contains current I/O device OPEN parameters.

Synopsis

$ZMODE
$ZM

Description

$ZMODE contains the parameters specified with the OPEN or USE command for the current device. The string returned contains the parameters used to open the current I/O device in canonical form. These parameter values are separated by backslash delimiters. Open parameters like "M" on TCP/IP IO are canonicalized to "PSTE". The "Y" and "K" parameter values are always placed last.

This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.

Examples

The following example uses $ZMODE to return the parameters of the current device:

  WRITE !,"The current OPEN modes are: ",$PIECE($ZMODE,"\")
  WRITE !,"The NLS collation is: ",$PIECE($ZMODE,"\",2)
  WRITE !,"The network encoding is: ",$PIECE($ZMODE,"\",4)
Copy code to clipboard

The following example sets parameters for the current device with the USE command. It checks the current parameters with $ZMODE before and after the USE command. To test whether a specific parameter was set, this example uses the $PIECE function with the backslash delimiter, and tests for a value using the Contains operator ([). (See Operators in Using Caché ObjectScript.):

Zmodetest
  WRITE !, $ZMODE
    IF $PIECE($ZMODE,"\")["S" {
      WRITE !, "S is set"  }
    ELSE {WRITE !, "S is not set" }
  USE 0:("":"IS":$CHAR(13,10))
  WRITE !, $ZMODE
    IF $PIECE($ZMODE,"\")["S" {
      WRITE !, "S is set"  }
    ELSE {WRITE !, "S is not set" }
  QUIT  
Copy code to clipboard

SAMPLES>DO ^zmodetest

RY\Latin1\K\UTF8\

S is not set

SIRY\Latin1\K\UTF8\

S is set

See Also

Feedback