APPTOOLS - Retrieve OS VxRyMz (RTVOSVER)

Where allowed to run:
  • Batch program (*BPGM)
  • Interactive program (*IPGM)
  • Batch ILE CL module (*BMOD)
  • Interactive ILE CL module (*IMOD)
Threadsafe: No
Parameters
Examples
Error messages

The APPTOOLS - Retrieve OS VxRyMz (RTVOSVER) command returns the current IBM i operating system version, release, and modification level to a user-supplied CL variable.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
RTNVRM CL Var for OS VxRyMz Character value Optional, Positional 1
RTNVER CL Var for OS Version Character value Optional, Positional 2
RTNREL CL Var for OS Release Character value Optional, Positional 3
RTNMOD CL Var for OS Modification Character value Optional, Positional 4
Top

CL Var for OS VxRyMz (RTNVRM)

Specifies a CL variable that receives the IBM i version in VxRyMz format. Normally a CL variable TYPE(*CHAR) LEN(6) is specified, but any length CL variable may be specified. For example, if the version of IBM i running is v7.1 it is returned as 'V7R1M0'. NOTE: When a shorter value is specified, only that portion of the VxRyMz is returned. For example if the return CL variable is LEN(4) then 'V7R1' is returned.

character-variable
Specify the optional CL variable that receives the IBM i OS version.
Top

CL Var for OS Version (RTNVER)

Specifies a CL variable that receives the IBM i version number in character format. The VERISON is returned as a 2-position character value. When the return CL variable is LEN(2) or greater, then '05', '06', or '07' is returned. When a LEN(1) variable is specified, then '5', '6', or '7' is returned.

character-variable
Specify the TYPE(*CHAR) CL variable of 1 or more bytes in length. to receive the IBM i operating system VERSION number.
Top

CL Var for OS Release YY (RTNREL)

Specifies a CL variable that receives the IBM i release number in character format. The RELEASE is returned as a 2-position character value. When the return CL variable is LEN(2) or greater, then '01', '02', '03' etc. is returned. When a LEN(1) variable is specified, then '1', '2', '2' etc. is returned.

character-variable
Specify the TYPE(*CHAR) CL variable of 1 or more bytes in length. to receive the IBM i operating system RELEASE number.
Top

CL Var for OS Modification (RTNMOD)

Specifies a CL variable that receives the IBM i modification level in character format. The MODIFICATION is returned as a 2-position character value. When the return CL variable is LEN(2) or greater, then '00', '01', '05' etc. is returned. When a LEN(1) variable is specified, then '0', '1', '5' etc. is returned.

character-variable
Specify the TYPE(*CHAR) CL variable of 1 or more bytes in length. to receive the IBM i operating system MODIFICATION level.
Top

Examples for RTVOSVER

Example 1: Simple Command Example

DCL &VRM TYPE(*CHAR) LEN(6)
RTVOSVER  VRM(&VRM)
IF (&VRM >= 'V7R1M0') THEN(DO)
   /* Do something for v7.1 and later here.
ENDDO
ELSE DO
   /* Do v6.1 and earlier stuff here
ENDDO

This command retrieves the full IBM i OS version identifier and then checks to see if the program is running on a v7r1 or later system.

Example 2: More Complex Command Example

DCL &VER TYPE(*CHAR) LEN(1)
DCL &REL TYPE(*CHAR) LEN(1)
RTVOSVER  VER(&VER) REL(&REL)
  IF (&VER >= '7' *AND &REL >= '2') THEN(DO)
     SNDPGMMSG MSG('You are running IBM i v7r2 or later.')
  enddo

This command receives the Version and Release into 1-position *CHAR CL variables and then uses them in the conditional statement.

Top

Error messages for RTVOSVER

*ESCAPE Messages

CPF9801
Object &2 in library &3 not found.
CPF9802
Not authorized to object &2 in &3.
CPF9803
Cannot allocate object &2 in library &3.
CPF9807
One or more libraries in library list deleted.
CPF9808
Cannot allocate one or more libraries on library list.
CPF9810
Library &1 not found.
CPF9811
Program &1 in library &2 not found.
CPF9812
File &1 in library &2 not found.
CPF9820
Not authorized to use library &1.
CPF9830
Cannot assign library &1.
CPF9899
Error occurred during processing of command.
Top