A REXX program consists of REXX language instructions that the REXX interpreter interprets directly. A program can also contain commands that the host environment executes, such as CICS commands (see Types of Commands).
/* Sample REXX Program */
SAY 'Hello world!'
This program starts with a comment line to identify it as a REXX program. A comment begins with /* and ends with */. More about comments and why you might need a REXX program identifier appears later in section Null Clause.
Hello world!
REXX addtwo
For this example, the first number you will enter is 42, and the
second number is 21. Here is the ADDTWO program: /**************************** REXX *********************************/
/* This program adds two numbers and produces their sum. */
/*******************************************************************/
say 'Enter first number.'
PULL number1 /* Assigns: number1=42 */
say 'Enter second number.'
PULL number2 /* Assigns: number2=21 */
sum = number1 + number2
SAY 'The sum of the two numbers is' sum'.'
The sum of the two numbers is 63.
Before you try any examples, please read the next two sections, Syntax of REXX Instructions and Typing in a Program.