zOs/REXX.O08/CONTSTCK

/***********************************************************************
   rexx control stack:
       maximal 256 tief, enthält procedure calls
               und jedes do..end, if usw.
       wird ganz schlimm mit if else if else if else if .....
       nachher stirbt's mit
            IRX0011I Error running CONTSTCK, line 42: Control stack full
***********************************************************************/
call ifElse 1
do i=1 to 100000
   call badGo i
   end
call contStack 1
exit
badGo: procedure expose m.
parse arg i
    if i //  2000 = 0 then
        say 'badGotTo' i
    do l1=1 to 1
      do l2=1 to 1
        do l3=1 to 1
      do l4=1 to 1
        do l5=1 to 1
            return
        end
      end
    end
    end
    end
endProcedure badGo
contStack: procedure expose m.
parse arg i
    if i //  20 = 0 then
        say 'contStack' i
    do l1=1 to 1
      do l2=1 to 1
        do l3=1 to 1
      do l4=1 to 1
        do l5=1 to 1
    call contStack i+1
        end
      end
    end
    end
    end
endProcedure contStack
ifelse: procedure expose m.
parse arg i
    say 'ifelse' i
    if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else if 0 then nop
    else
        call ifElse i+1
endProcedure ifElse
recursive: procedure expose m.
parse arg i
    if i //  20 = 0 then
        say 'recursive' i
    call recursive i+1
endProcedure recursive