Job Interview Questions and Answers for Mainframe Rexx Programmers

by Howard Fosdick with RexxLA members   © 2023

You should be able to complete this test in about a half hour. This is a “from memory” test only – no cell phone or computer access allowed. The answers follow the test.

1. What do these two Rexx statements accomplish?

social_security_number   =  '499-55-1212'
PARSE  VAR   social_security_number   comp1  '-'   comp2   '-'   comp3   .

2. What command can you use to define a new disk dataset for output from a Rexx program running under TSO when you want to specify such parameters as record length, block size, and more?

3. Why do you encode a FINIS operand on an EXECIO statement?

4. You have a disk dataset consisting of 20 data elements. At a minimum, how many EXECIO statements do you need to read the entire dataset?

5. Why do you code a SIGNAL instruction in a Rexx program?

6. What is the function of the ADDRESS instruction?

7. What is the function of the ADDRESS function?

8. What two Rexx instructions can be used to implement a Case construct?

9. How do you set the arithmetic precision – the number of significant digits for calculations – in a Rexx program?

10. What is the difference between the equal to ( = ) and strictly equal to ( == ) operators?

11. What is the remainder divide operator and why would you use it?

12. What word is required in the first line of a Rexx program for some execution environments?

13. What is the difference between the PUSH and QUEUE instructions?

14. What instruction could you code to leave an endless loop (a “do forever” loop) and proceed to the next statement following the DO loop?

15. What TSO external function would you code to get information about a dataset?

16. What is the function of the SYSCPUS TSO external function?

17. How can you enter an immediate command from within TSO?

18. What does the immediate command HE do?

19. Between the Rexx comparison, arithmetic, and concatenation operators, which has highest priority?

20. For the compound variable List.j what is the stem, and what is the tail (also called the subscript or index)?

21. How do you code a binary string constant within a Rexx program?

22. What are the OR and EXCLUSIVE OR operators, and what is the difference in how they operate?

23. What is DBCS and why would you use it?

24. When is the NOVALUE condition trap raised?

25. When you code a Rexx statement in your program, how can you continue it to a second line?

26. Why would you use the DIGITS function?

27. You want to speed up the execution of a TSO Rexx program you’ve just written – without changing the program code. What do you do?

28. You have an error number (error code), and you want to find out what it means. How can you do this from within a Rexx program?

29. You’re writing a Rexx program that interfaces to a Db2 table. How can you process each row from the table, one at a time?

30. Can you call Db2 database stored procedures from within a Rexx program? How?

31. Does the PULL instruction alter input data? Does PARSE PULL?

32. What is the effect of the period in this statement?

PARSE   VAR   my_string   item_one   item_two   .

33. How do you initialize all elements of the compound variable stem (aka, an array) named MY_ARRAY. to 0?


1. Answer: The first statement initializes the variable social_security_number to the character string value 499-555-1212. The second statement parses it into its three component pieces (as separated by the internal dashes) and places the components into the three variables comp1, comp2, and comp3, respectively. In other words, comp1 will contain 499, comp2 will contain 555, and comp3 will contain 1212.

2. Answer: ALLOC (or ALLOCATE). BPXWDYN is also correct.

3. Answer: To close the dataset (optionally after processing it).

4. Answer: 1. One EXECIO statement can read the entire dataset into an array or table (more accurately called a compound variable), or onto the stack.

5. Answer: To enable one of SIGNAL’s supported error conditions, and optionally specify its associated routine. Or to disable that error condition. (It’s not recommended, but some also use it to simulate the action of a GOTO statement.)

6. Answer: To set the execution environment for command(s) sent out from a Rexx program.

7. Answer: To tell your Rexx program what the current external command execution environment is.

8. Answer: IF and SELECT. (Note that WHEN is a keyword or clause within the SELECT statement; it is not a Rexx instruction.)

9. Answer: Use the NUMERIC instruction.

10. Answer: Strict comparison requires that two strings be identical (leading and trailing blanks count in the comparison.)

11. Answer: The operator is: // . You use it when you want to obtain the remainder of a division operation.

12. Answer: The word REXX placed inside a comment. Example: /* REXX */

13. Answer: PUSH adds an element to the queue or data stack in the order Last-In, First-Out (LIFO). QUEUE adds an element to the queue or data stack in the order First-In, First-Out (FIFO).

14. Answer: The correct answer is the LEAVE instruction. It alters the flow of control from within a DO loop to the statement following its END clause. Instructions like EXIT and RETURN will break out of the endless loop, but do not direct execution to the code following the DO loop. (You could also use SIGNAL for this purpose but this is poor programming practice.)

15. Answer: LISTDSI

16. Answer: It returns information about the CPUs currently online.

17. Answer: In TSO, you press the attention interrupt key to enter attention mode. Then you can enter your immediate command (such as HE, HT, HI, etc).

18. Answer: Halts execution of the program.

19. Answer: Arithmetic.

20. Answer: The stem is List. (it includes the period), and the tail (or subscript or index) is j

21. Answer: Code it as a string of 0’s and 1’s within single or double quote marks followed by the letter ‘b’ or ‘B’.
Examples: '0101'b or "0101"B

22. Answer: OR is:  |
OR means “true if either term is true,” while EXCLUSIVE OR means “true if either but not both terms are true.”

23. Answer: DBCS stands for the Double Byte Character Set. In DBCS, each character is represented by two bytes (instead of one). You might use it for working with languages that contain many unique characters, for example, Chinese or Japanese.

24. Answer: The NOVALUE conditions is raised when the NOVALUE error condition is enabled, and a variable is referenced that has not yet been initialized.

25. Answer: Encode a comma ( , ) at the end of the line to be continued.

26. Answer: It returns the setting of NUMERIC DIGITS (it returns the numeric precision).

27. Answer: Use the Rexx compiler.

28. Answer: One way is to use the ERRORTEXT function. It returns the error text associated with a given error number.

29. Answer: Declare a cursor. Then use it to retrieve and process the rows one by one.

30. Answer: Yes, just use the CALL command, addressed to Db2.

31. Answer: PULL automatically translates characters to their uppercase equivalents. PARSE PULL does not alter the data by performing uppercase translation.

32. Answer: The variable item_one contains the first data element parsed from the string called my_string, item_two contains the second, and the period ignores all subsequent data items. If the period were not encoded, item_two would contain the second and all subsequent input data elements concatenated together.

33. Answer: MY_ARRAY. = 0


25 or more questions answered correctly (about 75%) indicate a credible job candidate. Less than 20 questions correct indicate a candidate who is not credible.


Thanks to Rexx Language Association members for their feedback on these questions including Frank, Shmuel, David, Wayne, Rob, Mark, Chip, Walter, and others. .