The program REXXTRY.CMD (in the directory \OS2) is really useful to test some REXX statements. But it has one disadvantage: The input routine is very simple.
But, thanks to Albert Crosby, there's a simple way to overcome this disadvantage. Albert Crosby who's that you might ask. Well, Albert Crosby is the author of a REXX routine called CMDLINE1.CMD which is very suitable to extend the input routine from REXXTRY.CMD
To do this do the following:
Create a copy of the file REXXTRY.CMD and name it EREXXTRY.CMD.
Extract the source code of CMDLINE.CMD from this document (see Using the samples)
Load the file EREXXTRY.CMD into a text editor and append the source of CMDLINE1.CMD at the end of EREXXTRY.CMD.
Then insert the following lines in EREXXTRY.CMD before the line parse arg argrx:
/* ------------------------------------------------------------------ */
/* history of changes for RXT&T version: */
/* */
/* RXT&T v1.60 /bs */
/* - changed code to also work if REXXUTIL is not accessible */
/* */
/* RXT&T v1.70 /bs */
/* - corrected an error in the RxFuncAdd calls */
/* - in the previous version, undefined function keys lead to */
/* invalid return codes in cmdline. Corrected. */
/* - added code to save and load the history list to the routine */
/* cmdline */
/* The keys for handling the history file are: */
/* F2 - save the history list (overwrite an existing file) */
/* ALT-F2 - save the history list (append to an existing file) */
/* SHIFT-F2 - load the history list */
/* CTRL-F2 - change the history list file */
/* ALT-F4 - save history list and exit program */
/* - added online help for the edit keys (CTRL-F1) */
/* */
/* RXT&T v2.00 /bs */
/* - added code to handle situations when other programs drop the */
/* REXXUTIL functions */
/* RXT&T v2.30 /bs */
/* - added key definitions for loading and dropping REXXUTIL */
/* functions (F11 and F12) */
/* RXT&T v2.40 /bs */
/* - added code to show the version of the active REXX interpreter */
/* */
/* (c) 1996 Bernd Schemmer, Germany, EMail: Bernd.Schemmer@gmx.de */
/* */
/* */
ReStart: /* v2.00 */
if rxFuncQuery "SysCurPos" = 0 then /* v1.60 */
call rxFuncDrop "SysCurPos" /* v1.60 */
if rxFuncQuery "SysGetKey" = 0 then /* v1.60 */
call rxFuncDrop "SysGetKey" /* v1.60 */
/* load the necessary REXXUTIL v1.60 */
/* functions v1.60 */
call RxFuncAdd "SysCurPos", "RexxUtil", "SysCurPos" /* v1.70 */
call RxFuncAdd "SysGetKey", "RexxUtil", "SysGetKey" /* v1.70 */
!rexxUtilLoaded = 0 /* v1.60 */
/* check if the rxFuncAdd calls were v1.60 */
/* successful v1.60 */
signal ON Syntax Name RexxUtilNotLoaded /* v1.60 */
call SysCurPos /* v1.60 */
/* use the extended input v1.60 */
/* routine only if possible v1.60 */
!rexxUtilLoaded = 1 /* v1.60 */
/* name of the file for the history v1.70 */
/* list v1.70 */
!history.file = "EREXXTRY.HST" /* v1.70 */
/* redefine some keys */
!history.key.61 = "exit" /* F3 */
!history.key.104 = "?" /* ALT-F1 */
/* F11 load REXXUTIL v2.30 */
!history.key.133 = "call rxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'; call SysLoadFuncs; say 'REXXUTIL loaded.'";
/* F12 drop REXXUTIL v2.30 */
!history.key.134 = "call SysDropFuncs; say 'REXXUTIL functions dropped.'"
/* see Key redefinitions for further key codes */
RexxUtilNotLoaded: /* v1.60 */
/* ------------------------------------------------------------------ */
Now replace the line parse pull inputrx in EREXXTRY.CMD with
/* ------------------------------------------------------------------ */
parse version tVersion /* v2.40 */
say " --- Current REXX interpreter is: "tversion /* v2.40 */
if !rexxUtilLoaded <> 1 then /* v1.60 */
do /* v2.00 */
say " --- no extended keys available --- " /* v2.00 */
say " --- use ""signal restart"" to try to load" , /* v2.30 */
"the extended key support again --- " /* v2.30 */
inputrx = lineIN() /* v1.60 */
end /* v2.00 */
else /* v1.60 */
do /* v1.70 */
say " --- extended keys are active," || , /* v1.70 */
" CTRL-F1 = online help ---" /* v1.70 */
inputrx = cmdLine() /* v1.60 */
end /* v1.70 */
/* ------------------------------------------------------------------ */
Save the file EREXXTRY.CMD.
That's all! You've just created EREXXTRY.CMD - a clone of REXXTRY.CMD with a much more comfortable input routine.
See also: CMDLINE