RTVSYSVAL (Retrieve System Value)

RTVSYSVAL Command syntax diagram

 

Purpose

The Retrieve System Value (RTVSYSVAL) command is used in a CL program or REXX procedure to retrieve the value from the specified system value. The value is returned (copied) to the specified CL variable in the program.

 

Restrictions

  1. The attributes of the system value and the receiving CL variable must be compatible.
  2. You must have *ALLOBJ and *SECADM special authorities to change security related system values.

 

Required Parameters

SYSVAL
Specifies the name of the system value whose value is retrieved and returned for use in the program. The names and descriptions of the system values that can be specified are in the Work Management book.

RTNVAR
Specifies the name of the CL program variable that receives the system value being returned. The type and length for the CL variable when it was declared must be compatible with that of the system value being received. The attributes of individual system values are described in the Work Management Link to PDF book.

In general, the type of the return variable must match the type of the system value. For character system values that are 1 character long, the CL variable can be a character or logical variable. For character and logical system values, the length of the CL variable must equal the length of the system value. For decimal system values, the CL variable must have a length that is greater than or equal to the length of the system value.

Example for RTVSYSVAL

RTVSYSVAL  SYSVAL(QDATE)  RTNVAR(&DATE)

This command retrieves the date value from the system value QDATE and copies it into the CL variable &DATE. The CL variable must be declared as a 6-character variable to match the attributes of the QDATE system value.

Error messages for RTVSYSVAL

*ESCAPE Messages

CPF1028
&1 not valid for parameter SYSVAL.
CPF1074
SYSVAL(QMONTH) not valid for Julian date format.
CPF1094
CL variable not same type as system value &1.
CPF1095
CL variable length not valid for system value &1.
CPF1842
Cannot access system value &1.
CPF268D
Unable to access system value &1.