Built-in session variables
DB2® provides several built-in session variables that contain information about the server and application process. The value of a built-in session variable can be obtained by invoking the GETVARIABLE function with the name of the built-in session variable.
DB2 provides the
following built-in session variables:
- SYSIBM.APPLICATION_ENCODING_SCHEME
- Contains a string that corresponds to the value that is specified for the APPLICATION ENCODING field on the DSNTIPF installation panel. The value will be EBCDIC, ASCII, UNICODE, or 1-65533, and this session variable can never be null.
- SYSIBM.COBOL_STRING_DELIMITER
- Contains a string that corresponds to the value that is specified for the STRING DELIMITER field on the DSNTIPF installation panel. The value will be DEFAULT, ", or ', and this session variable can never be null.
- SYSIBM.DATA_SHARING_GROUP_NAME
- Contains a string that corresponds to the name of the data sharing group for this DB2 subsystem. If the subsystem is not part of data sharing group, the null value is returned.
- SYSIBM.DATE_FORMAT
- Contains a string that corresponds to the value that is specified for the DATE FORMAT field on the DSNTIP4 installation panel. The value will be ISO, JIS, USA, EUR, or LOCAL, and this session variable can never be null.
- SYSIBM.DATE_LENGTH
- Contains a string that corresponds to the value that is specified for the LOCAL DATE LENGTH field on the DSNTIP4 installation panel. The value will be 10-254, or 0 for no exit, and this session variable can never be null.
- SYSIBM.DECIMAL_ARITHMETIC
- Contains a string that corresponds to the value that is specified for the DECIMAL ARITHMETIC field on the DSNTIP4 installation panel. The value will be DEC15, DEC31, 15, or 31, and this session variable can never be null.
- SYSIBM.DECIMAL_POINT
- Contains a string that corresponds to the value that is specified for the DECIMAL POINT IS field on the DSNTIPF installation panel. The value will be '.' or ',' and this session variable can never be null.
- SYSIBM.DEFAULT_DECFLOAT_ROUND_MODE
- Contains a string that corresponds to the value that is specified for the DECFLOAT ROUNDING MODE field on the DSNTIPF installation panel. This session variable can never be null.
- SYSIBM.DEFAULT_SSID
- Contains a string that corresponds to the value that is specified for the GROUP ATTACH field on the DSNTIPK installation panel or the SUBSYSTEM NAME field on the DSNTIPM installation panel. This session variable can never be null.
- SYSIBM.DEFAULT_LANGUAGE
- Contains a string that corresponds to the value that is specified for the LANGUAGE DEFAULT field on the DSNTIPF installation panel. The value will be ASM, C, CPP, IBMCOB, FORTRAN, or PL/I, and this session variable can never be null.
- SYSIBM.DEFAULT_LOCALE_LC_CTYPE
- Contains a string that corresponds to the value that is specified for the LOCALE LC_CTYPE field on the DSNTIPF installation panel. This session variable can never be null.
- SYSIBM.DISTRIBUTED_SQL_STRING_DELIMITER
- Contains a string that corresponds to the value that is specified for the DIST SQL STR DELIMTR field on the DSNTIPF installation panel. The value will be ", or ', and this session variable can never be null.
- SYSIBM.DSNHDECP_NAME
- Contains a string that corresponds to the fully qualified data set name of the data set from which the DSNHDECP or a user-specified application defaults module was loaded. For instance, 'DSN910.SDSNEXIT(DSNHDECP)'. This session variable can never be null.
- SYSIBM.DYNAMIC_RULES
- Contains a string that corresponds to the value that is specified for the USE FOR DYNAMICRULES field on the DSNTIP4 installation panel. The value will be YES or NO, and this session variable can never be null.
- SYSIBM.ENCODING_SCHEME
- Contains a string that corresponds to the value that is specified for the DEF ENCODING SCHEME field on the DSNTIPF installation panel. The value will be EBCDIC, ASCII, or UNICODE, and this session variable can never be null.
- SYSIBM.MIXED_DATA
- Contains a string that corresponds to the value that is specified for the MIXED DATA field on the DSNTIPF installation panel. The value will be YES or NO, and this session variable can never be null.
- SYSIBM.NEWFUN
- Contains a string that represents the default maximum level of the SQL function syntax that is accepted by the DB2 precompiler or the DB2 coprocessor, regardless of the DB2 function level. For more information about the NEWFUN option, see Descriptions of SQL processing options.
- SYSIBM.PACKAGE_NAME
- Contains a string that corresponds to the name of the package that is currently being executed. If a package is not currently being executed, the null value is returned. (This situation can occur when the plan that is being executed bound one or more DBRMs directly).
- SYSIBM.PACKAGE_SCHEMA
- Contains a string that corresponds to the collection id of the package that is currently being executed. If a package is not currently being executed, the null value is returned.
- SYSIBM.PACKAGE_VERSION
- Contains a string that corresponds to the version of the package that is currently being executed. If a package is not currently being executed, the null value is returned.
- SYSIBM.PAD_NUL_TERMINATED
- Contains a string that corresponds to the value that is specified for the PAD NUL-TERMINATED field on the DSNTIP4 installation panel. The value will be YES or NO, and this session variable can never be null.
- SYSIBM.PLAN_NAME
- Contains a string that corresponds to the name to the plan that is currently being executed. This session variable can never be null.
- SYSIBM.SECLABEL
- Contains a string that corresponds to the RACF® SECLABEL value, if any, that has been defined for the current userid. If a value has not been defined, the null value is returned.
- SYSIBM.SQL_STRING_DELIMITER
- Contains a string that corresponds to the value that is specified for the SQL STRING DELIMITER field on the DSNTIPF installation panel. The value will be DEFAULT, ", or ', and this session variable can never be null.
- SYSIBM.SSID
- Contains a string that corresponds to the actual DB2 subsystem identifier for this DB2 subsystem. This session variable can never be null.
- SYSIBM.STANDARD_SQL
- Contains a string that corresponds to the value that is specified for the STD SQL LANGUAGE field on the DSNTIP4 installation panel. The value will be YES or NO, and this session variable can never be null.
- SYSIBM.SYSTEM_NAME
- Contains a string that corresponds to the name of the DB2 for z/OS® subsystem, as defined in field SUBSYSTEM NAME on installation panel DSNTIPM. This session variable can never be null.
- SYSIBM.SYSTEM_ASCII_CCSID
- Contains a value that represents the ASCII CCSIDs that are in use on this system. The information is returned as a comma-delimited string that corresponds to the ASCII CCSID that was specified on installation panel DSNTIPF. The three values that are returned correspond to the SBCS, MIXED, and graphic CCSID that are in use for ASCII data on this system. A value of 65534 for the MIXED or graphic CCSID indicates that this system does not support storing data in that CCSID. This session variable can never be null.
- SYSIBM.SYSTEM_EBCDIC_CCSID
- Contains a value that represents the EBCDIC CCSIDs that are in use on this system. The information is returned as a comma-delimited string that corresponds to the EBCDIC CCSID that was specified on installation panel DSNTIPF. The three values that are returned correspond to the SBCS, MIXED, and graphic CCSID that are in use for EBCDIC data on this system. A value of 65534 for the MIXED or graphic CCSID indicates that this system does not support storing data in that CCSID. This session variable can never be null.
- SYSIBM.SYSTEM_UNICODE_CCSID
- Contains a value that represents the Unicode CCSIDs that are in use on this system. The information is returned as a comma-delimited string that corresponds to the UNICODE CCSID that was specified on installation panel DSNTIPF. The three values that are returned correspond to the SBCS, MIXED, and graphic CCSID that are in use for Unicode data on this system. This session variable can never be null.
- SYSIBM.TIME_FORMAT
- Contains a string that corresponds to the value that is specified for the TIME FORMAT field on the DSNTIP4 installation panel. The value will be ISO, JIS, USA, EUR, or LOCAL, and this session variable can never be null.
- SYSIBM.TIME_LENGTH
- Contains a string that corresponds to the value that is specified for the LOCAL TIME LENGTH field on the DSNTIP4 installation panel. The value will be 8-254 or 0 for no exit, and this session variable can never be null.
- SYSIBM.VERSION
- Contains a string that represents the version of DB2. The format of product identifier values is pppvvrrm, where ppp is a 3-letter product code (such as DSN for DB2), vv is the version, rr is the release, and m is the modification level. For example, DSN10015 identifies DB2 10 in new-function mode, the value is ‘DSN10015'. The product code (ppp) is one of the following values:
- AQT for IBM® DB2 Analytics Accelerator for z/OS
- ARI for DB2 Server for VSE & VM
- DSN for DB2 for z/OS
- JCC for IBM Data Server Driver for JDBC and SQLJ
- QSQ for DB2 for i
- SQL for DB2 for Linux, UNIX, and Windows
- 0 - 1
- Modification levels in conversion and enabling-new-function mode from DB2 Version 8 (CM8, CM8*, ENFM8, and ENFM8*)
- 2 - 3
- Modification levels in conversion and enabling-new-function mode from DB2 9 (CM9, CM9*, ENFM9, and ENFM9*)
- 4
- Not used.
- 5 - 9
- Modification levels in new-function mode.
This session variable can never be null.
For example, the following statement sets the
value of host variable hv1 to the name of the plan
that is currently being executed:
SET :hv1 = GETVARIABLE('SYSIBM.PLAN_NAME');
For more information about the GETVARIABLE function, see GETVARIABLE.