HLASM Toolkit Feature User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


The UNTIL and WHILE keywords

HLASM Toolkit Feature User's Guide
GC26-8710-10

The test generated by the UNTIL keyword, as with those generated by the indexing group, is used at the loop termination. The test generated by the WHILE keyword, on the other hand, tests whether to enter a loop at all prior to its execution. For both keywords, the parameterization is identical to that of the IF macro. The UNTIL and WHILE operands accept compound predicates in the same format as used on the IF statement, with the exception that the CC= keyword operand is not allowed.

The DO WHILE example:
        DO  WHILE=(TM,FLAGS,X'80',O)
          Code for F
        ENDDO
produces:
        DO  WHILE=(TM,FLAGS,X'80',O)
          BC    15,#@LB2
#@LB3     DC    0H
          Code for F
        ENDDO
#@LB2     DC    0H
          TM    FLAGS,X'80'
          BC    1,#@LB3
          BC    1,L1
The DO UNTIL is coded in the same manner:
        DO  UNTIL=(TM,FLAGS,X'80',O)
          Code for F
        ENDDO
and produces:
        DO  UNTIL=(TM,FLAGS,X'80',O)
#@LB2     DC    0H
          Code for F
        ENDDO
#@LB3     DC    0H
          TM    FLAGS,X'80'
          BC    15-1,#@LB2
It is possible to create a compound DO with both UNTIL and WHILE parameters on the same macro. For example:
        DO  WHILE=(SRP,AMOUNT,64-3,5,M),UNTIL=10
          Code for F
        ENDDO
produces:
        DO  WHILE=(SRP,AMOUNT,64-3,5,M),UNTIL=10
#@LB2     DC    0H
          SRP   AMOUNT,64-3,5
          BC    15-4,#@LB1
          Code for F
        ENDDO
#@LB5     DC    0H
          BC    15-10,#@LB2
#@LB1     DC    0H
The operand formats for the WHILE and UNTIL keywords are the same as those of the IF-type macros and can be used with Boolean operators as in the following example:
        DO WHILE=(CLI,WORD1,EQ,2,OR,CLI,WORD1,EQ,4),                  X
              UNTIL=(CLI,WORD1,EQ,1,OR,CLI,WORD1,EQ,3)
           Code for F
        ENDDO
produces (with ASMMREL ON in effect):
        DO WHILE=(CLI,WORD1,EQ,2,OR,CLI,WORD1,EQ,4),                  X
              UNTIL=(CLI,WORD1,EQ,1,OR,CLI,WORD1,EQ,3)
#@LB2     DC    0H
          CLI   WORD1,2
          BRC   8,#@LB4
          CLI   WORD1,4
          BRC   15-8,#@LB1
#@LB4     DC    0H
          Code for F
        ENDDO
#@LB5     DC    0H
          CLI   WORD1,1
          BRC   8,#@LB7
          CLI   WORD1,3
          BRC   15-8,#@LB2
#@LB7     DC    0H
#@LB1     DC    0H

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014