Only one instruction may be placed after a THEN, ELSE, WHEN or OTHERWISE keyword, but REXX provides a way of bracketing instructions together so that they can be treated as a single instruction. To do this, place the keyword DO before the group of instructions, and the keyword END after the instructions.
/* If My_Variable is greater than 10,
 then say "It's true" and set it to 10. Otherwise,
 say "It's not true" and print My_Variable's value. */
My_Variable = 5 + 2
IF My_Variable > 10 THEN DO
   SAY "It's true."
   My_Variable = 10
END
ELSE DO
   SAY "It's not true."
   SAY 'My_Variable =' My_Variable
END
Here's an example of using DO/END to enclose multiple instructions inside one of the WHEN conditionals in a SELECT group. Note the DO/END in the second WHEN instruction.
/* Check My_Variable for a variety of conditions, 
   but execute instructions for only 1 condition. */
SELECT
   WHEN My_Variable = 10 THEN SAY "It's equal to 10."
   WHEN My_Variable < 10 THEN DO
      SAY "It's less than 10."
      My_Variable = My_Variable + 1 /* Increment it */
   END
   WHEN My_Variable < 20 THEN SAY "It's less than 20."
   OTHERWISE
      SAY "It must be > 19."
END
The DO can be placed immediately after the THEN, ELSE, WHEN, or OTHERWISE. Or, the DO keyword can be placed upon a separate line. It's your preference which is easier to read. The following two examples are identical. (Remember that indenting is also optional).
/* If My_Variable is greater than 10,
  then say "It's true" and set it to 10. */
IF My_Variable > 10 THEN DO
   SAY "It's true."
   My_Variable = 10
END

/* If My_Variable is greater than 10,
  then say "It's true" and set it to 10. */
IF My_Variable > 10 THEN
   DO
      SAY "It's true."
      My_Variable = 10
   END