Rexx and Batch Files

You can use a Rexx program whenever you now use Windows batch files or Unix/Linux shell scripts. The following example shows a Windows batch file that processes user input to display a help message:

Windows batch file
@echo off
if &percent;1.==. goto msg
if &percent;1 == on goto yes
if &percent;1 == off goto no
if &percent;1 == ON goto yes
if &percent;1 == OFF goto no
if &percent;1 == On goto yes
if &percent;1 == oN goto yes
if &percent;1 == OFf goto no
if &percent;1 == OfF goto no
if &percent;1 == Off goto no
if &percent;1 == oFF goto no
if &percent;1 == oFf goto no
if &percent;1 == ofF goto no
helpmsg &percent;1
goto exit
goto exit
prompt i[p]
goto exit

Here is the equivalent program in Rexx:

Rexx program
/* help&per;cmd -- Get help for a system message */
arg action .
when action="" then "helpmsg"
when action="ON" then "prompt i[p]"
when action="OFF" then do
otherwise "helpmsg" action