SYSVAR: Retrieving the Value of a z/OS System Variable

How to:

Available Operating Systems: z/OS

The SYSVAR function populates a Dialogue Manager amper variable with the contents of any z/OS system variable. System variables are in the format [&]name[.], where the dot is optional. They can be provided by the operating system or can be user defined. The function can be called in a -SET command.

Syntax: How to Retrieve the Value of a z/OS System Variable

-SET &dmvar = SYSVAR('length','[&]sysvar[.]','outfmt');

where:

&dmvar

Alphanumeric

Is the name of the Dialogue Manager variable to be populated with the value of the z/OS system variable.

length

Alphanumeric

Is the length of the next parameter in the call. Do not include the escape character in the length, if one is present in the sysvar argument.

[&|]sysvar[.]

Alphanumeric

Is the name of the system variable to be retrieved. Note that the ampersand (&) and the dot (.) are optional. If the ampersand is included, it must be followed by the escape character (|).

outfmt

Alphanumeric

Is the format of the returned value enclosed in single quotation marks.

Example: Retrieving the Value of the z/OS SYSNAME Variable

The following example populates the Dialogue Manager variable named &MYSNAME2 with the value of the z/OS SYSNAME variable:

-SET &MYSNAME2=SYSVAR('7','SYSNAME','A8');     
-TYPE SYSNAME:&MYSNAME2                        

The output is similar to the following:

SYSNAME:IBI1