HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


SETC instruction

HLASM Language Reference
SC26-4940-06

The SETC instruction assigns a character value to a SETC symbol. You can assign whole character strings, or concatenate several smaller strings together. The assembler assigns the composite string to your SETC symbol. You can also assign parts of a character string to a SETC symbol by using the substring notation; see Substring notation.

A character string consists of any combination of characters enclosed in apostrophes. Variable symbols are allowed. The assembler substitutes the representation of their values as character strings into the character expression before evaluating the expression. Up to 1024 characters are allowed in a character expression.

You can change the character value assigned to a SETC symbol. This lets you use the same SETC symbol with different values for character comparisons in several places, or for substituting different values into the same model statement.
Read syntax diagramSkip visual syntax diagram
>>-variable_symbol--SETC--character_value----------------------><

variable symbol
Is a variable symbol.

A global variable symbol in the name field must have been previously declared as a SETC symbol in a GBLC instruction. Local SETC symbols need not be declared in an LCLC instruction. The assembler considers any undeclared variable symbol found in the name field of a SETC instruction as a local SET symbol. The variable symbol is assigned a type attribute value of U.

character_value
Is a character value specified by:
  • An operation code attribute reference
  • A type attribute reference
  • A character expression

The assembler assigns the character string value represented in the operand field to the SETC symbol in the name field. The string length must be in the range 0 (null character string) through 1024 characters.

When a SETA or SETB symbol is specified in a character expression, the unsigned decimal value of the symbol (with leading zeros removed) is the character value given to the symbol.

A duplication factor can precede a character expression or substring notation. The duplication factor can be any non-negative arithmetic expression allowed in the operand of a SETA instruction. For example:
&C1      SETC            (3)'ABC'
assigns the value 'ABCABCABC' to &C1.
A zero duplication factor results in a null (zero-length) string.
Notes:
  1. The assembler evaluates the represented character string (in particular, the substring; see Substring notation) before applying the duplication factor. The resulting character string is then assigned to the SETC symbol in the name field. For example:
    &C2      SETC            'ABC'.(3)'ABCDEF'(4,3)
    assigns the value 'ABCDEFDEFDEF' to &C2.
  2. If the character string contains double-byte data, then redundant SI/SO pairs are not removed on duplication. For example:
    &C3      SETC            (3)'<.A.B>'
    assigns the value '<.A.B><.A.B><.A.B>' to &C3.
  3. To duplicate double-byte data, without including redundant SI/SO pairs, use the substring notation. For example:
    &C4      SETC            (3)'<.A.B>'(2,4)
    assigns the value '.A.B.A.B.A.B' to &C4.
  4. To duplicate the arithmetic value of a previously defined ordinary symbol with an absolute value, first assign the arithmetic value to a SETA symbol. For example:
    A        EQU             123
    &A1      SETA            A
    &C5      SETC            (3)'&A1'
    assigns the value '123123123' to &C5.
Figure 1. Defining character (SETC) expressions
┌───────────┐
│           │
│Character  │
│Expression │
│           │
└─────┬─────┘
      │
      V Can be any of
      ├─────────────┬─────────────┬──────────────────────┐
      V             V             V                      V
┌─────┴─────┐ ┌─────┴──────┐ ┌────┴──────────────┐ ┌─────┴────────┬────────────┐
│           │ │            │ │                   │ │              │            │
│ Character │ │ CharExpr   │ │ Character-Valued  │ │ (Duplication │ CharExpr   │
│ Value     │ │     . <──┐ │ │ Built-In Function │ │ Factor)      │            │
│           │ │ CharExpr │ │ │                   │ │              │            │
└─────┬─────┘ └──────────┼─┘ └───────────────────┘ └──────────────┴────────────┘
      │                  │
      │                  └── Period (.) = Concatenation Character
      V Can be any of
      ├─────────────┬─────────────┬─────────────┐
      V             V             V             V
┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐
│ Substring │ │ Variable  │ │ Self-     │ │ Attribute¹│
│           │ │ Symbol    │ │ Defining  │ │ Reference │
│           │ │           │ │ Term      │ │           │
│           │ │           │ │           │ │ T' or O'  │
└───────────┘ └───────────┘ └───────────┘ └───────────┘
Note:
  1. The attribute reference term must not be preceded by a duplication factor.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014