TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Donald Woolwine
from: Jonathan Markevich
date: 1994-10-23 00:03:22
subject: REXX

>programs. I have seem to run into a problem, I think. I am getting a stack
  >full
  >error after about 45 entries into a looping routine similar to the one that
  >follows.

    You're pushing the return address of M1 onto the stach and not popping it
off.  Replace your M1: label with the line "do forever", the
"call M1" in the
middle with "iterate" and the last "call M1" with
"end" (the do forever)

    [some deleted]

DW>M1:
  >Say 'Press any key to continue'
  >key = SysGetKey(noecho)

DW>IF key=
  >   THEN

DW>R1:
  >SAY " You entered "'R'
  >call M1

DW>T1:
  >SAY " I DON'T UNDERSTAND, TRY AGAIN"
  >CALL M1

  >stack full message but I can find no info on removing the problem or clearing
  >the stack. My only source of ref is the on-line info with came with OS/2 and
  >what little info OS/2 Unleashed. Any help would be appriciated. Thank you

    Just avoid putting anything there if you don't pull it off.  CALL stores
the return address of the function on the stack.  You could just leave off the
CALL and run the label directly, but how abou this for an improvement...

---8<---
/* Get a key via REXX       */
/* Jonathan Markevich  1994 */

do forever
    Say 'Press any key to continue'    
    pull key                      /* You don't need a REXXUTIL function */

    select
         when key = 'r' then
              Say 'You entered R'

         when key = 'x' then
              leave               /* I added this for kicks */

         when key = 't' then
              Say 'You entered T'

         otherwise
              Say 'I don't understand!'

    end  /* Select */

end  /* Do */
---8<---

     Ideally, compare the UPPERCASE key entered.  i.e.  
if TRANSLATE(key)="T"... this allows for upper or lowercase to be entered.

    Have fun!  Welcome to the wonderful world of programming!

              Yo-Han    
___
 * MR/2 2.09A NR * Don't assume malice for what stupidity can explain.
--- FidoPCB v1.5 beta-'j'

* Origin: FidoNet: CAP/CANADA Support BBS : 416-287-0234 (1:250/710)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 949 712/353 623 713/888 800/1
@PATH: 250/710 701 99 3615/50 229/2 12/2442 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.