z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Defining character data - &STR

z/OS TSO/E CLISTs
SA32-0978-00

Use the &STR built-in function to define character data and prevent the CLIST from evaluating it. The data can be any expression or statement, and can include nested variables and characters of the double-byte character set (DBCS) within DBCS delimiters.

For example, the statement SET DIMENSNS=&STR(2*4) defines 2*4 as a character string and assigns the string to the variable &DIMENSNS; Without the &STR built-in function, you can not make the desired assignment because a CLIST needs to evaluate 2*4 as an arithmetic expression and set &DIMENSNS to the value 8.

The &STR built-in function suppresses arithmetic evaluations only for the data between the parentheses. If you set &STATS to &DIMENSNS,; &STATS; will contain the value 8, not the character string 2*4. To preserve the character string, code:
SET STATS=&STR(&DIMENSNS)

Special procedures are required when defining parentheses as character data. Unlike other CLIST operators, left and right parentheses can appear at the beginning or in the middle of character data without having to be defined as character data. Only when they appear at the end of a character string do parentheses have to be defined with &STR, like the other operators.

The following examples show how to define right and left parentheses to appear as character data at the end of a character string called TEXT:

Right parenthesis:
SET &A = )
SET &B = TEXT&STR(&A)           /* result: B = TEXT)
Left parenthesis:
SET &C = &STR((
SET &D = TEXT&STR(&C)           /* result: D = TEXT(

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014