Start of change

CHECK_MIRROR_VERSION scalar function

The CHECK_MIRROR_VERSION scalar function returns either the active version number for a version-group and version-name combination or an indication whether the active version number is greater than or equal to the specified version. The active version number is the value of the ACTIVE_VERSION column in the QSYS2.MIRROR_VERSION_LIST view that matches the entry-source, version-group, and version-name parameters that have a STATE of ACTIVE.

Authorization: For the authority needed to use this function, see Authorization.

Read syntax diagramSkip visual syntax diagramCHECK_MIRROR_VERSION( VERSION_GROUP =>  version-group ,VERSION_NAME =>  version-name ,VERSION_IDENTIFIER => version-identifier,ENTRY_SOURCE => entry-source)
The schema is QSYS2.
version-group

A character or graphic string expression that identifies the group name of the version entry to check.

version-name

A character or graphic string expression that identifies the version within a version-group to check.

version-identifier

A character or graphic string expression that identifies the version identifier of the version entry to check. version-identifier must be in the form xxx.yyy.zzz with each piece of the version containing the digits 0-9. Each segment of the version can contain one to three digits. If less than three digits are used, the value is logically padded on the left with leading zeros.

Version identifiers will be compared to each other to determine the latest (largest value) version. This is done by first comparing the xxx values. If they are equal, then the yyy values are compared. If the values are still equal, the zzz values are compared. version-identifier can be specified using only one or two parts of the version identifier. For example, xxx.yyy or xxx. Any omitted parts of a version identifier use an implicit value of zero for comparisons.

If version-identifier is omitted, the active version will be returned as the result of this function.

Start of changeentry-sourceEnd of change
Start of change

A character or graphic string expression that identifies the source of the version entry to check.

SYSTEM
The version entry to check was added by the IBM i operating system using an internal operating system interface.
USER
The version entry to check was added by a user. This is the default.
End of change

The result of the function is VARCHAR(11).

The result is one of the following values when the version-identifier parameter is provided:
NO
Either the ACTIVE_VERSION column in the QSYS2.MIRROR_VERSION_LIST view that matches the version-group and version-name parameters is not greater than or equal to the version-identifier parameter, or no version information was found that matches the parameters.
YES
The ACTIVE_VERSION column in the QSYS2.MIRROR_VERSION_LIST view that matches the version-group and version-name parameters is greater than or equal to the version-identifier parameter specified on the function.

The result is one of the following values when the version-identifier parameter is not provided:

xxx.yyy.zzz
The value of the ACTIVE_VERSION column value in the QSYS2.MIRROR_VERSION_LIST view that matches the version-group and version-name parameters.
null
The null value is returned if no version information is found with a STATE of ACTIVE that matches the version-group and version-name parameters.

Examples

  • Checks and returns the active version number for group name SOFTVEND01 with version name APPLICATION_LIBRARY_01. This returns the null value if version group SOFTVEND01 with a name of APPLICATION_LIBRARY_01 does not exist or does not have an active version.
    VALUES QSYS2.CHECK_MIRROR_VERSION(VERSION_GROUP => 'SOFTVEND01', 
                                      VERSION_NAME  => 'APPLICATION_LIBRARY_01');
  • Checks the active version number is greater than or equal to 1.3.0 for group name SOFTVEND02 with version name APPLICATION_LIBRARY_02.
    VALUES QSYS2.CHECK_MIRROR_VERSION(VERSION_GROUP      => 'SOFTVEND02', 
                                      VERSION_NAME       => 'APPLICATION_LIBRARY_02', 
                                      VERSION_IDENTIFIER => '1.3.0');
End of change