Create Low-Level Environment (QsnCrtEnv) API


  Required Parameter Group:


  Omissible Parameter Group:


  Returned Value:


  Default Public Authority: *USE

  Service Program: QSNAPI

  Threadsafe: No

The Create Low-Level Environment (QsnCrtEnv) API creates an operating environment for low-level interface routines.


Authorities and Locks

Display file authority
*USE
Display file library authority
*USE
Exit routine authority
*EXECUTE

Required Parameter Group

Low-level environment description
INPUT; CHAR(*)

The environment description for the low-level interfaces. The format of this parameter is shown in Format of the Low-Level Environment Description.

Length of low-level environment description
INPUT; Binary(4)

The length of the low-level environment description parameter. The value specified must be 16, 36, or 38.


Omissible Parameter Group

User extension information
INPUT; CHAR(*)

The user extension information is used to associate data and exit routines with the low-level environment. This essentially enables the object-oriented programming concept of inheritance, allowing the low-level environment to be extended in a natural way. The user extension information cannot be changed once the environment has been created. The format of this parameter is shown in Format of the Low-Level User Environment Extension Information.

User extension information length
INPUT; BINARY(4)

The length of the user extension information parameter. If this parameter is specified with a zero value, the user extension information parameter is ignored. If a non-zero value is specified, it must be 48 and the user extension parameter is required.

Low-level environment handle
OUTPUT; BINARY(4)

The low-level environment that is created as a result of this operation. This handle can be used across activation groups if the activation group in which the handle was created is still active.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter. If this parameter is omitted, diagnostic and escape messages are issued to the application.


Returned Value

Low-level environment handle
OUTPUT; BINARY(4)

The value for parameter 5 is returned. If an error occurs during processing, returns -1.


Format of the Low-Level Environment Description



Format of the Low-Level User Environment Extension Information



Field Descriptions

In the following descriptions, specifying the value Same indicates the current value when using the Change Low-Level Environment (QsnChgEnv) API. The default value refers to the value set by the Initialize Low-Level Environment Description (QsnInzEnvD) API.

Alternative help key support. Specifies if the alternative help key is used. The default is no alternative help key support.

The possible values for this field are:

CDRA conversions to X'3F'. When CDRA conversion takes place, all characters not supported in the target CCSID are converted to X'3F'. Sending data containing X'3F' to the display causes adverse effects.

This field specifies whether the DSM low-level routines are to check for X'3F' in the data to be displayed and perform any conversions if necessary. Conversion will be performed for both direct and indirect operations on data output through the QsnWrtDta and QsnWrtTDta APIs, and input through the QsnReadInp, QsnReadMDT, QsnReadMDTAlt, QsnReadMDTAlt, QsnReadImm, and QsnReadMDTImmAlt APIs.

The default is convert if character conversion (see below) is specified as convert. Otherwise, the default is standard. (See Limitations and Restrictions for further details.)

The possible values for this field are:

Character conversion. This field specifies whether CDRA conversion takes place on the data when the job CCSID does not match that of the display device. Conversion will be performed for both direct and indirect operations on data output through the QsnWrtDta and QsnWrtTDta APIs, and input through the QsnReadInp, QsnReadMDT, QsnReadMDTAlt, QsnReadMDTAlt, QsnReadImm, and QsnReadMDTImmAlt APIs.

The CCSID for the display device is determined from the CHRID of the device. The default is convert if the job CCSID does not match that of the underlying device; otherwise, standard is the default.

The possible values for this field are:

Coexistence. Whether DSM coexists with other screen I/O methods, such as DDS- or UIM-coded interfaces, during the course of this application. Better performance can be achieved if coexistence is not required; the DSM APIs can assume the state of the device, for example, wide or normal mode.

The default is 1.

The possible values for this field are:

Color support. This field determines the color selection used when both a monochrome and a color display attribute are supplied. The default is select.

The possible values for this field are:

DBCS support. This field specifies whether the data being sent to the display contains DBCS data. This field affects, for example, how data is handled within sessions. For devices that do not support DBCS data, the default is standard; for DBCS-capable devices, it is mixed. If a value other than standard is specified for a device that does not support DBCS data, a CPFA306 error will occur.

The possible values for this field are:

Display file. The name of the display file to be used. The first 10 characters contain the file name, and the last 10 characters contain the library name. By specifying a display file, you can, for example, direct the input/output of different DSM environments to different devices, and you can specify the restore display parameter on the display file at creation time. The default for this field is blanks, which indicate that the system-supplied display file should be used.

If a file name is specified, the file must contain a record named USRRCD. This record must have the USRDFN keyword specified.

Exit routine to call when low-level environment changed. Exit routine to call when the low-level environment is changed through the QsnChgEnv or QsnSetEnvWinMod API. For a description of the parameters passed to this routine, see Change Low-Level Environment Exit Routine. Specify NULL for this field if no exit routine is required.

Exit routine to call when low-level environment deleted. Exit routine to call when the low-level environment is deleted through the QsnDltEnv API. The exit routine will be called before the environment itself is deleted. For a description of the parameters passed to this routine, see Delete Low-Level Environment Exit Routine. Specify NULL for this field if no exit routine is required.

Invite active. This field determines whether each write that is sent out causes the device to be invited. After the device is invited, the user is able to enter data, but the application can continue processing instead of waiting for input. When the application is ready for the input, it can call QsnReadInvited, which will issue a read from invited device operation.

The invite active flag is ignored by the read APIs, like QsnReadMDT. If the operation is indirect, then the read command will be added to the command buffer. This command buffer can be passed into the QsnReadInvited API, where it will be sent out before the read from invited device is done. If the operation is direct, then the read command will be sent in a data stream to the device. The new data stream will cause the invite to be retracted. A read with wait will be performed.

If the display file value is specified for the environment, the INVITE keyword must be specified on the USRRCD record of the specified display file.

The timeout value for the read from invited device operation can be controlled, by supplying a display file for the environment. The WAITRCD parameter on the CRTDSPF command can be set to the desired timeout value. See the return value for the QsnReadInvited API to determine the return value if the read from invited device operation times out.

The possible values for this field are:

Prevent override. This field determines whether the display file used by DSM can be overridden or not. This value is ignored if the display file value is not specified.

The possible values for this field are:

User data associated with the environment. A pointer to any data the user wants to associate with this environment. This field can be used by the programmer to attach information to the low-level environment that can be of any format. For example, if multiple environments are being used, a list of the fields currently defined in an environment could be associated with the environment through this pointer. Specify NULL for this field if you do not have any user data.

Target device. The program device name of the target display device for the environment. This parameter must be specified with a value of *REQUESTER, which is the default.


Exit Routine Error Handling

If an exception occurs during the processing of an exit routine, the exception is ignored and processing continues. A CPFA318 will be issued as a diagnostic message only. You can explicitly handle errors in an exit routine by adding an exception handler to the routine.


Change Low-Level Environment Exit Routine

This exit routine, if specified on the user extension information, is called after the environment is changed through the QsnChgEnv or QsnSetEnvWinMod API. The following parameter is passed to the exit routine:



Change Low-Level Environment Exit Routine Parameter

Low-level environment handle
INPUT; BINARY(4)

A handle for the environment that was changed.


Delete Low-Level Environment Exit Routine

This exit routine, if specified on the user extension information, is called before the environment is deleted. The following parameter is passed to the exit routine:



Delete Low-Level Environment Exit Routine Parameter

Low-level environment handle
INPUT; BINARY(4)

A handle for the environment that was deleted.


Error Messages



API introduced: V2R3

[ Back to top | Dynamic Screen Manager APIs | APIs by category ]