

Task

Demonstrate a   for-loop   where the step-value is greater than one.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreach
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


*        Loops/For with a specified step     12/08/2015
LOOPFORS CSECT
         USING  LOOPFORS,R12
         LR     R12,R15
*     == Algol style ================ test at the beginning
         LA     R3,BUF             idx=0
         LA     R5,0               from 5 (from-step=0)
         LA     R6,5               step 5
         LA     R7,25              to 25
LOOPI    BXH    R5,R6,ELOOPI       for i=5 to 25 step 5
         XDECO  R5,XDEC              edit i
         MVC    0(4,R3),XDEC+8       output i
         LA     R3,4(R3)             idx=idx+4
         B      LOOPI              next i
ELOOPI   XPRNT  BUF,80             print buffer
         BR     R14
BUF      DC     CL80' '            buffer
XDEC     DS     CL12               temp for edit
         YREGS  
         END    LOOPFORS