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


Counting

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

This case applies when a count is to be decremented by 1 each time, and the loop is to be terminated when the count reaches zero. This is achieved by specifying just the FROM keyword. In the situation where only two parameters are used, a BCT loop terminator is generated.

For example:
        DO  FROM=(Rx,number)
          Code for F
        ENDDO
produces:
        DO  FROM=(R15,3)
          LA    R15,3
#@LB2     DC    0H
          Code for F
        ENDDO
#@LB3     DC    0H
          BCT   R15,#@LB2

For a slightly shorter loop, write the FROM keyword with three parameters to designate an additional register. In this case, a BCTR is generated as the loop terminator.

For example:
        DO  FROM=(Rx,=A(TEST),Ry)
          Code for F
        ENDDO
produces:
        DO  FROM=(R15,=A(LIMIT),R14)
          LA    R14,#@LB2
          L     R15,=A(LIMIT)
#@LB2     DC    0H
          Code for F
        ENDDO
#@LB3     DC    0H
          BCTR  R15,R14

If no value appears in the FROM keyword, the load instruction is not generated.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014