
Example Using a DO FOREVER Loop
/****************************** REXX *******************************/
/* This exec prints data sets named by a user until the user enters*/
/* a null line.
*/
/*******************************************************************/
DO FOREVER
SAY 'Enter the name of the next data set or a blank to end.'
PULL dataset_name
IFdataset_name = '' THEN
EXIT
ELSE
DO
"PRINTDS DA("dataset_name")"
SAY dataset_name 'printed.'
END
END
This example sends data sets to the printer and then issues a message that the
data set was printed. When the user enters a blank, the loop ends and so does the
exec. To end the loop without ending the exec, use the LEAVE instruction, as
described in the following topic.
LEAVE Instruction
The LEAVE instruction causes an immediate exit from a repetitive loop. Control
goes to the instruction following the END keyword of the loop. An example of using
the LEAVE instruction follows:
Example Using the LEAVE Instruction
/******************************** REXX *****************************/
/* This exec uses the LEAVE instruction to exit from a DO FOREVER */
/* loop that sends data sets to the printer.
*/
/*******************************************************************/
DO FOREVER
SAY 'Enter the name of the next data set.'
SAY 'When there are no more data sets, enter QUIT.'
PULL dataset_name
IFdataset_name = 'QUIT' THEN
LEAVE
ELSE
DO
"PRINTDS DA("dataset_name")"
SAY dataset_name 'printed.'
END
END
SAY 'Good-bye.'
ITERATE Instruction
Another instruction, ITERATE, stops execution from within the loop and passes
control to the DO instruction at the top of the loop. Depending on the type of DO
instruction, a control variable is increased and tested and/or a condition is tested to
determine whether to repeat the loop. Like LEAVE, ITERATE is used within the
loop.
DO count = 1 TO 10
IFcount = 8
THEN
Using Looping Instructions
50
z/OS V1R1.0 TSO/E REXX User’s Guide
Содержание TSO/E REXX
Страница 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 2: ......
Страница 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Страница 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Страница 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Страница 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 241: ......