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


SETB instruction

HLASM Language Reference
SC26-4940-06

Use the SETB instruction to assign a bit value to a SETB symbol. You can assign the bit values, 0 or 1, to a SETB symbol directly and use it as a switch.

If you specify a logical (Boolean) expression in the operand field, the assembler evaluates this expression to determine whether it is true or false, and then assigns the value 1 or 0 to the SETB symbol. You can use this computed value in condition tests or for substitution.
Read syntax diagramSkip visual syntax diagram
>>-variable_symbol--SETB--binary_value-------------------------><

variable_symbol
Is a variable symbol.

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

binary_value
Is a binary bit value specified as:
  • A binary digit (0 or 1)
  • A binary value enclosed in parentheses
    An arithmetic value enclosed in parentheses is allowed. This value can be represented by:
    • An unsigned self-defining term
    • A SETA symbol
    • A previously defined ordinary symbol with an absolute value
    • An attribute reference other than the type attribute reference.
    If the value is 0, the assembler assigns a value of 0 to the symbol in the name field. If the value is not 0, the assembler assigns a value of 1.
  • A logical expression enclosed in parentheses

    A logical expression is evaluated to determine if it is true or false; the SETB symbol in the name field is then assigned the binary value 1 or 0, corresponding to true (1) or false (0). The assembler assigns the explicitly specified binary value (0 or 1) or the computed logical value (0 or 1) to the SETB symbol in the name field.

Figure 1. Defining logical expressions
┌───────────┐
│           │
│Logical¹   │
│Expression │
│           │
└─────┬─────┘
      │
      V Can be any of
      ├─────────────┬─────────────────────────────────────────────────┐               Logical Operators Allowed
      V             V                                                 V
┌─────┴─────┐ ┌─────┴─────┬───────────┬───────────┐ ┌───────────┬─────┴─────┐         OR      Intersection
│           │ │           │  OR       │           │ │           │           │         AND     Union
│  Logical² │ │Logical²   │  OR NOT   │  Logical  │ │    NOT    │Logical²   │         NOT     Negation
│  Term     │ │Expression │  AND      │  Term     │ │           │Expression │         XOR     Exclusive OR
│           │ │           │  AND NOT  │           │ │           │           │
│           │ │           │  XOR      │           │ │           │           │
│           │ │           │  XOR NOT  │           │ │           │           │
└─────┬─────┘ └───────────┴───────────┴───────────┘ └───────────┴───────────┘
      │
      V Can be any of
      ├─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐
      V             V             V             V             V             V             V
┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴─────┐
│           │ │ SETB²     │ │           │ │           │ │           │ │ Predefined│ │           │
│ Logical²  │ │ Variable  │ │Arithmetic²│ │     0²    │ │     1²    │ │ Absolute  │ │ Logical²  │
│ Relation  │ │ Symbol    │ │Value      │ │           │ │           │ │ Ordinary  │ │ Function  │
│           │ │           │ │           │ │           │ │           │ │ Symbol    │ │           │
└─────┬─────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘ └───────────┘
      │
      V Can be any of
      ├─────────────────────────────────────────┐
      V                                         V
┌─────┴─────┐                             ┌─────┴─────┐
│           │                             │           │
│Arithmetic │                             │ Character │
│Relation   │                             │ Relation  │
│           │                             │           │
└─────┬─────┘                             └─────┬─────┘
      │                                         │                                     Relational Operators Allowed
      V Which is                                V Which is
┌─────┴─────┬───────────┬───────────┐     ┌─────┴─────┬───────────┬───────────┐       EQ      Equal
│           │  EQ, NE   │           │     │           │  EQ, NE   │           │       NE      Not equal
│Arithmetic │  LE, LT   │Arithmetic │     │ Character³│  LE, LT   │ Character³│       LE      Less than or equal
│Comparand  │  GE, GT   │Comparand  │     │ Comparand │  GE, GT   │ Comparand │       LT      Less than
│           │           │           │     │           │           │           │       GE      Greater than or equal
└─────┬─────┴───────────┴───────────┘     └─────┬─────┴───────────┴───────────┘       GT      Greater than
      │                                         │
      V Which can be                            V Can be any of
      │                                         ├─────────────┬─────────────┬──────────────────┐
      │                                         V             V             V                  V
┌─────┴─────┐                             ┌─────┴─────┐ ┌─────┴─────┐ ┌─────┴──────────┐ ┌─────┴─────┐
│           │                             │           │ │           │ │ Type Attribute │ │Character  │
│Arithmetic │                             │Character  │ │ Substring │ │ or Operation   │ │Exp. and   │
│Expression │                             │Expression │ │ Notation  │ │ Code           │ │Substring  │
│           │                             │           │ │           │ │ Reference⁴     │ │Notation   │
└───────────┘                             └───────────┘ └───────────┘ └────────────────┘ └───────────┘
Notes:
  1. Outermost expression must be enclosed in parentheses in SETB and AIF instructions.
  2. Optional parentheses around terms and expressions at this level.
  3. Must be in the range 0 through 1024 characters.
  4. Must stand alone and not be enclosed in apostrophes.

Rules for Coding Logical Expressions: The following is a summary of coding rules for logical expressions:

  • A logical expression must not contain two logical terms in succession.
  • A logical expression can contain two logical operators in succession; however, the only allowed combinations are OR NOT, XOR NOT and AND NOT. The two operators must be separated from each other by one or more spaces.
  • Any logical term, relation, or inner logical expression can be optionally enclosed in parentheses.
  • The relational and logical operators must be immediately preceded and followed by at least one space, except when written (NOT bexpr).
  • A logical expression can begin with the logical unary operator NOT.
  • A logical expression can contain up to 18 logical operators. The relational and other operators used by the arithmetic and character expressions in relations do not count toward this total.
  • Up to 255 levels of nested parentheses are allowed.
  • Absolute ordinary symbols specified in logical expressions must be defined before the logical expression is encountered.
  • The assembler determines the type of a logical relation by the first comparand. If the first comparand is a character expression that begins with an apostrophe, then the logical relation is a character relation, otherwise the assembler treats it as an arithmetic relation.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014