Why would you want to use REXX from within Kermit 95? Reasons might include:
Kermit 95's REXX programming interface consists of the single command, REXX. REXX <command> executes the given REXX command, for example:
REXX SAY "Hello"
or:
REXX RETURN "Goodbye"
or:
REXX CALL filename [ text ]
which executes a REXX program from the given file. The text, if any, is passed to the REXX program, where it is available as ARG(1).
A REXX command or program invoked via Kermit 95's REXX command can also execute Kermit 95 commands from within REXX procedures that are invoked via Kermit 95's REXX CALL command, by enclosing them in single quotes, for example:
'set parity none' 'return \v(parity)' say rc
The RETURN value from the REXX command or program is available in the Kermit 95 variable \v(rexx). Set this by including a RETURN <value> command in your REXX command or program.
There are three types of functionality provided in the Kermit 95/REXX interface:
Let's say you want to execute a one-line REXX program from within Kermit 95. You would use the Kermit 95 "REXX" command. The format of the command is:
rexx rexx-command
where "rexx-command" is everything after the keyword REXX to the end of the line. A simple example:
Kermit/2> rexx say "hello"
executes the REXX command SAY with the parameter "hello", which prints the word "hello" on your screen.
Another example, returning a value from REXX:
Kermit/2> rexx return 4 * 4
the REXX command "return 4 * 4" calculates the value "16" and returns it to Kermit 95. Kermit 95 stores the return value from the last REXX command in \v(rexx):
Kermit/2> echo \v(rexx) 16 Kermit/2>
Let's say you want to execute a series of REXX commands, but you don't want to create a REXX command file:
Kermit/2> rexx say "hello"\13 return 0
This prints the string "hello" and then returns the value "0" to Kermit 95. Notice that \13 (Carriage Return, Ctrl-M) was placed between the commands. This is necessary because REXX expects to find each command separated by a return character just as if it was being read from a file.
To execute a REXX command file, use:
Kermit/2> rexx call oofa.cmd
where "oofa.cmd" is the name of your REXX command file.
Now let's say you want to gain access to a Kermit 95 variable value from within a REXX program, change a Kermit 95 setting, or execute a Kermit 95 command. You could alter your program so it is called in separate parts from a Kermit 95 TAKE file or macro. But there is a better way. Just include the Kermit 95 command in your REXX program. For example, you want to set Kermit's parity from within your REXX program:
/* Beginning of REXX program file */ set parity "none"
Let's say you want to set a REXX variable to the value of a Kermit 95 variable:
'return \v(parity)' parity = rc
Notice the single quotes around and the "return" command before the Kermit 95 variable statement. REXX passes the quoted statement to Kermit 95 for evaluation. Kermit 95 interprets the command and returns to REXX the value of the parity variable. This value is then stored in the REXX special variable RC. RC stores the return value of all non-REXX commands. The next statement assigns the value of REXX variable RC to the REXX variable parity.
At this time there are a number of limitations in Kermit 95s REXX support. Some of these may be addressed in future releases:
Click Back on your Browser's Toolbar to return.