REXX is a platform-independent Scripting Language. It uses extensively in the mainframe. It is a free-flow language.
Let us take a simple program (Reference “Informit”)
/* GUESSING GAME -- try guessing the randomly-generated number */
do while end_this_game <> ’N’
the_number = random(1,5) /* generate the random number */
say "I’m thinking of a number between 1 and 5, what is it?"
pull your_guess
say "You entered: " your_guess
if your_guess = the_number then
say ’You guessed it! The number was: ’ the_number
else do
say ’Sorry, the number was: ’ the_number
say ’We should have bet on this!’
end
say ’Try again? [Y or N]: ’
pull end_this_game
end
The above program is self-explanatory.
Points:
- REXX program always starts with /*…….*/ (No problem you can span comments in multi-lines)
- Variables initialization is optional
- There is a number of error-handling conditions available. Some of them are: novalue, error, failure, halt, notready, syntax, lastdigits
- PULL means in Cobol it is Accept. Say- in Cobol it is Display.
In my next posts, I will give details from starting of REXX and its usage in the mainframe.