Examples of user symbols

Like system symbols, user symbols can represent any type of variable information in a program. When planning to define user symbols, you should first determine if the system symbols provided by the system, and their associated substitution texts, meet your needs. Define user symbols only if you need additional values.

Suppose you are writing a program that is to access several data sets each time it runs. The user is to provide the name of the specific data set to be used.

Your first step is to create a pattern, or "skeleton", for the data set name. You decide to use the name of the system on which the program runs as a high-level qualifier, and the name of the data set that the user provides as a low-level qualifier.

You decide to use the &SYSNAME system symbol to identify the system on which the program runs. Because &SYSNAME is already defined to the system, and you do not want to override its substitution text, you do not need to provide it to ASASYMBM. Because the system does not define a symbol to identify the input from the user, you provide the following user symbol to ASASYMBM:
 TESTDATA       DC    C'&&DATAID.'      Define the symbol &DATAID
You begin by specifying, in your program, references to three data sets:
 &SYSNAME..&DATAID..DS1
 &SYSNAME..&DATAID..DS2
 &SYSNAME..&DATAID..DS3
You then specify that the user is to provide, as input to the program, the substitution text for the &DATAID user symbol. For example:
 EXEC PGM=MYPGM,PARM='DATA1'
Your program provides, as input to ASASYMBM, a symbol table that contains the &DATAID user symbol, with the substitution text that the user provided as input to the program:
 DATAIDSUBTEXT  DC    C'DATA1'          Substitution text for &DATAID
To determine the data set name to be used, your program also provides to ASAYSMBM the pattern for the data set name, including the symbols for which substitution is to occur. For example:
 SYS1.&SYSNAME..&DATAID..DS1
 SYS1.&SYSNAME..&DATAID..DS2
 SYS1.&SYSNAME..&DATAID..DS3
The data set names resolve to the following names after symbolic substitution:
 SYS1.DATA1.DS1
 SYS1.DATA1.DS2
 SYS1.DATA1.DS3

Calling the ASASYMBM service explains how to call ASASYMBM to perform the substitution described in the example.