/* REXXTRY is an interactive EXEC which allows the user to enter any REXX command, which will then be interpreted (executed) immediately. It is very useful for trying commands and look- ing at results of commands without having to create an EXEC. If the user enters an invalid REXX command, an error message is given and the user remains under the control of the EXEC. Any valid REXX statement is OK, including CMS and CP commands. Since the user can create variables while using this EXEC, the variables used in the program had to be protected. This was done by using rather strange names in the EXEC. Users reading this EXEC should note how much more difficult it is to compre- hend than a similar EXEC with meaningful names. Reference: "The System Product Interpreter (REXX) Examples and Techniques" by G. Brodock; IBM Washington Systems Center; Gaithersburg, Maryland. Technical Bulletin GG22-9361-00 02/84 */ parse source . . fnyx . parse arg fynz if fynz='' | fynz='?' then do 'VMFCLEAR' say fnyx 'allows you to interactively execute REXX instructions -' say 'each instruction string is executed when you press Enter or Return.' end if fynz='?' then do say 'You may also specify a REXX statement directly on the call for' say 'immediate execution.' exit; end if fynz^='' then do fzzs=''; fxex=1 push fynz; end else do fxex=0 say 'Go on - try a few...' say say 'To end enter "Exit"; use "?" for access to REXX help.' fzzs=copies('.',130) end trace='Off' fzzw='<'fnyx'>' top: signal on syntax rc=0 do iynz=1 last=lynz /* available for user to retrieve */ parse pull lynz select when lynz='' then say fnyx': Enter EXIT to end or "?" for REXX tutorial' when lynz=? then do; help rexx menu; say fnyx': Ready.'; end otherwise rc='X' call setline; trace (trace) interpret lynz trace 'Off' if rc='X' then fzzl='' else if rc^=0 then fzzl='R('rc');' fzzw; else fzzl='R;' fzzw say left(fzzl||fzzs,max(linesize(),40)) end /* select */ if fxex & queued()=0 then exit /* single line request */ end /* iynz */ setline: traceline=sigl return result syntax: trace Off; say if sigl<=traceline then /* trace in error */ do say 'Invalid trace argument, set to "All".' trace='All'; signal top; end rc=rc+20000 say 'You had a syntax error there (RC = ' rc':' errortext(rc-20000)')' if fynz^='' then do; pull /* remove the EXIT */ src=rc say 'Better try again' 'PROMPT' fnyx lynz exit src end say 'Better try again (or type "Help" for more information)' help='EXEC REX' rc 'PROMPT' lynz signal top testsub: say 'In test subroutine...' say 'Returning...' return 1234