Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.27.5 PERFORM with VARYING Phrase



The VARYING phrase increases or decreases the value of one or more identifiers or index-names, according to certain rules. (See "Varying Phrase Rules" in topic 6.2.27.10.)

The Format 4 VARYING phrase PERFORM statement can serially search an entire 7-dimensional table.


    ___ Format 4 _____________________________________________________________________________________ 
   |                                                                                                  |
   | >>__PERFORM____________________________________________________________________________________> |
   |                                                                                                  |
   | >__ _procedure-name-1__ _______________________________ __| phrase 1 |__ ______________ _ ____>< |
   |    |                   |_ _THROUGH_ __procedure-name-2_|                |_| phrase 2 |_| |       |
   |    |                     |_THRU____|                                                     |       |
   |    |                                      (1)                                            |       |
   |    |_| phrase 1 |__imperative-statement-1_____END-PERFORM________________________________|       |
   |                                                                                                  |
   | phrase 1:                                                                                        |
   | |__ ____________________________ __VARYING__ _identifier-2_ __FROM__ _identifier-3_ __BY_______> |
   |    |_ ______ __TEST__ _BEFORE_ _|           |_index-name-1_|        |_index-name-2_|             |
   |      |_WITH_|        |_AFTER__|                                     |_literal-1____|             |
   |                                                                                                  |
   | >__ _identifier-4_ __UNTIL__condition-1________________________________________________________| |
   |    |_literal-2____|                                                                              |
   |                                                                                                  |
   | phrase 2:                                                                                        |
   |    <_______________________________________________________________                              |
   | |____AFTER__ _identifier-5_ __FROM__ _identifier-6_ __| phrase 3 |_|___________________________| |
   |             |_index-name-3_|        |_index-name-4_|                                             |
   |                                     |_literal-3____|                                             |
   |                                                                                                  |
   | phrase 3:                                                                                        |
   | |__BY__ _identifier-7_ __UNTIL__condition-2____________________________________________________| |
   |        |_literal-4____|                                                                          |
   |                                                                                                  |
   | Note:                                                                                            |
 X | (1)  Imperative-statement-1 is optional as an IBM extension.                                     |
   |                                                                                                  |
   |__________________________________________________________________________________________________|

Note: If procedure-name-1 is specified, imperative-statement and the END-PERFORM phrase must not be specified. If procedure-name-1 is omitted, the AFTER phrase must not be specified.

identifier-2 thru 7

X Must name a numeric elementary item. These identifiers cannot be
X windowed date fields.

literal-1 thru 4
Must represent a numeric literal.

condition-1, condition-2
Can be any condition described under "Conditional Expressions" in topic 6.1.6. If the condition is true at the time the PERFORM statement is initiated, the specified procedure(s) are not executed.

After the condition(s) specified in the UNTIL phrase are satisfied, control is passed to the next executable statement following the PERFORM statement.

If any of the operands specified in condition-1 or condition-2 is subscripted, reference modified, or is a function-identifier, the subscript, reference-modifier, or function is evaluated each time the condition is tested.


X Floating-point data items and literals can be used anywhere a numeric data
X item or literal can be specified.

When TEST BEFORE is indicated, all specified conditions are tested before the first execution, and the statements to be performed are executed, if at all, only when all specified tests fail. When TEST AFTER is indicated, the statements to be performed are executed at least once, before any condition is tested.

If neither the TEST BEFORE nor the TEST AFTER phrase is specified, the TEST BEFORE phrase is assumed.

Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.