2

When writing scripts for execution in USS I'd like to be able to access z/OS symbols like &SYSNAME. Ideally, it would be nice to access them as environment variables but if there is a command sequence I'd be satisfied with that.

Here is the reference for the Symbols in the z/OS documentation in the MVS Init and Tuning Reference that are available but the doc lacks a reference for use in specific environments.

1 Answer 1

4

The z/OS static symbols are accessible from a USS shell via the sysvar command.

For example:

user1: >sysvar SYSNAME
SYS1
user1: >sysvar SYSPLEX
PLX1

On z/OS 2.3 (not sure about earlier versions), a substring of the symbolic value can be directly returned by enclosing the symbol name in single-quotes, then adding a starting position (and optionally a length, separated by a colon) within parentheses after the symbol name:

user1: >sysvar 'SYSNAME'
SYS1
user1: >sysvar 'SYSNAME(4)'
1
user1: >sysvar 'SYSNAME(3:2)'
S1

The admittedly brief documentation for this command is located here: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxa500/sysvar.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .