Test 015: REXX for OS/2

Objectives
Given a set of code examples, determine the results of OS/2 commands both correctly and incorrectly coded. Identify when REXX determines that a clause is a command clause. identify how a command clause is treated by REXX. Identify when to use CALL vs. "CALL". Identify error conditions associated with issuing commands from a REXX program. Identify features and constraints of RC when used to capture OS/2 command return codes.
 * SECTION 1 - REXX BASICS
 * Identify uses of REXX for OS/2.
 * Identify features that make REXX for OS/2 a popular programming language.
 * Identify features associated with REXX for OS/2: possible components of a REXX for OS/2 installation, steps involved in creating and running an OS/2 REXX program, the distinction between an OS/2 REXX program and an OS/2 .CMD file, and the result of running a REXX for OS/2 program without the initial comment.
 * Determine the difference between an interpretive vs. a compiled language; identify whether REXX for OS/2 is an interpretive or compiled language.
 * Identify features and purpose of the tokenized image associated with a REXX program.
 * Identify types of REXX clauses and how each type is handled by REXX.
 * Identify features and uses of the various REXX tokens.
 * Identify valid REXX expressions; use the order of precedence chart to resolve complex expressions.
 * Identify and use the four types of REXX operators: string concatenation, arithmetic operators, comparison operators, and Boolean operators.
 * Identify features of compound symbols, including their components and the constraints associated with them; given code examples, determine the results of using a compound symbol.
 * SECTION 2 - PROGRAM CONTROL
 * Identify features of REXX branching instructions: IF-THEN-ELSE and SELECT; given code examples, determine the results of using these instructions.
 * Identify features and components of DO groups and DO loops, including simple do groups, controlled repetitive loops, conditional loops, and the LEAVE and ITERATE instructions; given code examples, determine the results of using the various types of loops.
 * SECTION 3 - USING OS/2 COMMANDS
 * Identify the REXX instruction used to pass commands to alternate external environments.
 * Identify the three methods used to issue OS/2 commands from a REXX program.

SECTION 4 - DEBUGGING TOOLS

Identify features and constraints of REXX debugging tools, including REXXTRY, PMREXX, TRACE, interactive TRACE, and RXTRACE.

SECTION 5 - FUNCTIONS AND SUBROUTINES

Identify features of REXX that foster adherence to structured programming techniques. Distinguish between REXX functions and subroutines. Identify features and constraints of internal routines; given code examples, determine the results of using internal routines. Given code examples, determine the contents of the RESULT special variable after execution of internal routines. Identify two ways in which to use the ARG statement; given code examples, determine the results of using ARG and PARSE ARG. Identify features and constraints of the ARG built-in function; given a code example that uses the ARG built-in function, determine the results. Identify features of the PROCEDURE and PROCEDURE EXPOSE instructions; given code examples, determine the results of using these instructions. Identify the search order REXX uses when it encounters a CALL instruction or function invocation. Identify the correct syntaxes for using a built-in function; given code examples and reference information, determine the results of using built-in functions. Given code examples, determine the results of using external routines.

SECTION 6 - QUEUES

Given code examples, determine the results of using the PULL and PARSE PULL instructions, both when there is information on the queue and when the queue is empty; distinguish between PULL and PARSE PULL. Given code examples, determine the results of using the PUSH and QUEUE instructions. Given a code example using the QUEUED function, determine the results. Identify features of the session queue. Identify features of private queues; given code examples, determine the results of using private queues, both within and between programs. Identify features of the RXQUEUE filter of OS/2; given code examples, determine the results of using the RXQUEUE filter.

SECTION 7 - PARSING

Describe parsing and how it is used in REXX programs. Given several choices, identify the types of patterns that can be used to parse character strings. Given code examples that parse with words, determine the results. Identify the differences between PARSE VALUE and PARSE VAR. Given code examples, determine the results of using PARSE VALUE and PARSE VAR. Given code examples that parse with literal strings, determine the results. Given code examples that parse by position, determine the results. - Given a code example that combines patterns (words, literals, position), determine the results.


 * SECTION 8 - HANDLING ERRORS
 * Determine when the following conditions would be raised: ERROR, FAILURE, HALT, NOTREADY, NOVALUE, SYNTAX.
 * Given a set of choices, determine the results when various conditions are raised and no traps have been set.
 * Distinguish between the CALL ON and SIGNAL ON instructions; given code examples, determine the results of using these instructions.
 * Given code examples, determine the results of using features provided by REXX which aid in error handling.
 * SECTION 9 - INPUT/OUTPUT
 * Identify features of the REXX built-in functions that handle I/O.
 * Given code examples, determine the results of using the REXX built-in functions that handle I/O.


 * SECTION 10 - REXX AND APPLICATIONS
 * Given a set of choices, identify the most common way of extending the function of OS/2 REXX.
 * Identify the prerequisite to using an external function package, including the type of instruction necessary to perform this prerequisite, frequency required for this prerequisite, and result of not performing this prerequisite.
 * Given a set of choices, identify features of REXXUTIL.
 * Identify features and constraints of the REXXUTIL functions that modify the Workplace Shell.

Sample Test

 * SECTION 1 - REXX BASICS
 * 1. Which are valid REXX variables?
 * a. 4some
 * b. some4
 * c. !some4
 * d. .some.4


 * 2. Which character is used to separate multiple REXX clauses on the same line?
 * a. ;
 * b. ,
 * c. :
 * d. \

3. What is the result of the expression 3**2**2?

a. 12 b. 36 c. 64 d. 81 SECTION 2 - PROGRAM CONTROL 4. What is the final value of CTR after executing DO CTR = 1 to 25 by 5?

a. 21 b. 25 c. 26 d. unknown SECTION 3 - USING OS/2 COMMANDS 1) /* */ 2) 3) type filename 4) "type" filename 5) type filename "| more" 6) type filename | more

5. Given the above code sample and given that filename is a variable, which lines would execute successfully?

a. Line 3 b. Line 4 c. Line 5 d. Line 6

6. Which conditions are associated with OS/2 commands?

a. HALT b. ERROR c. FAILURE d. NOTREADY SECTION 4 - DEBUGGING TOOLS 7. What are two ways to activate tracing without putting a trace instruction in a program?

a. PMREXX b. PMTRACE c. RXTRACE d. REXXTRY

8. When interactive trace pauses, which options are valid?

a. pressing the + key b. pressing the enter key c. turning interactive trace off d. changing the source code SECTION 5 - FUNCTIONS AND SUBROUTINES 9. What is the effect of the RETURN instruction in a main routine?

a. It ends the program. b. It produces a syntax error. c. It returns to the beginning of the program. d. It displays a return value at the command prompt.

10. Which statements describe the ARG instruction?

a. It leaves lowercase alphabetic characters in lowercase. b. It converts lowercase alphabetic characters to uppercase. c. It can be used to receive arguments from the queue. d. It can be used to receive arguments from the command prompt.

1) /*  NAMES.CMD   */ 2)  arg first second third 3) say "first is "first 4)  say "second is "second 5) say "third is "third

11. Given the above code sample and given that the program name is NAMES.CMD, if the user runs it by typing -- names Groucho Chico Harpo Zeppo -- at the command prompt, what would line 5 display?

a. third is Harpo b. third is HARPO c. third is Harpo Zeppo d. third is HARPO ZEPPO SECTION 6 - QUEUES 12. Which statements describe private queues?

a. they can be deleted with RXQUEUE b. they are deleted when the session is closed c. there can only be one private queue per OS/2 session d. there can be multiple private queues per OS/2 session

1) /*  */ 2) 3)  push "North" 4)  queue "South" 5) push "East" 6)  queue "West"

13. Given that the queue is empty when the above program begins, which item would be at the top of the queue after the program has run?

a. North b. South c. East d. West SECTION 7 - PARSING

1) /*   */ 2) 3)  pull name 4)  say name 5) parse pull name 6)  say name

14. Given the above code sample and given that the session queue is empty when the program begins, if at line 3 the user types in -- Franklin D. Roosevelt -- what would line 4 display?

a. Franklin b FRANKLIN c. Franklin D. Roosevelt d. FRANKLIN D. ROOSEVELT

1) /*   */ 2) 3)  pull first last 4)  say "*"last"*" 5) parse pull first last 6)  say "*"last"*"

15. Given the above code sample and given that the session queue is empty when the program begins, if at line 5 the user types in -- Hans Christian Andersen -- what would line 6 display?

a. *Christian* b *CHRISTIAN* c. *Christian Andersen* d. *CHRISTIAN ANDERSEN*

1) /*   */ 2) 3)  address = "Florence Italy" 4)  parse var address city "," country 5) say "*"city"*" 6)  say "*"country"*"

16. Given the above code sample, what would line 6 display?

a. ** b * * c. * Florence Italy* d. * FLORENCE ITALY* SECTION 8 - HANDLING ERRORS 17. When does the FAILURE condition occur?

a. when a syntax error occurs b. when Ctrl + Break is pressed c. when an input/output error occurs d. when an uninitialized variable is used e. when a command issues a non-zero return code f. when a severe error prevents processing of a command

18. What happens when the ERROR condition occurs and no trap has been set?

a. The condition is ignored. b. Interactive trace is activated. c. The program issues a warning message. d. The program ends and a message is displayed. SECTION 9 - INPUT/OUTPUT 19. Which statements describe the LINEIN function?

a. Its initial position is top of file. b. Its initial position is end of file. c. It reads from the queue as a default. d. It reads from the keyboard as a default.

20. Which statements describe the LINEOUT function?

a. Its initial position is top of file. b. Its initial position is end of file. c. It can be called as a subroutine. d. It can be executed as a command. SECTION 10 - REXX AND APPLICATIONS 21. Which REXXUTIL function is used to modify Workplace Shell objects?

a. SysModifyObject b. SysSetObjectData c. WinModifyObject d. WinSetObjectData

22. Which REXXUTIL function is used to modify OS2.INI?

a. SysIni b. SysModifyIni c. WinIni d. WinModifyIni REXX for OS/2 Sample Test 015 ANSWER KEY

1. bc

2. a

3. d

4. c

5. abc

6. bc

7. ac

8. bc

9. a

10. bd

11. d

12. ad

13. c

14. d

15. c

16. a

17. f

18. a

19. ad

20. bc

21. b

22. a