PERFORM command (COBOL)
The PERFORM command transfers control explicitly to one or more statements and implicitly returns control to the next executable statement after execution of the specified statements is completed. The keywords cannot be abbreviated.
- command
- A valid Debug Tool command.
Repeating:
>>-PERFORM--+----------------------------+----------------------> | .-BEFORE-. | '-+------+--TEST--+--------+-' '-WITH-' '-AFTER--' >--+----------------------------------------------------+-------> '-VARYING--reference--FROM--reference--BY--reference-' .---------. V | >--UNTIL--condition----command-+--END-PERFORM--;---------------><
- reference
- A valid Debug Tool COBOL reference.
- condition
- A simple relation condition.
- command
- A valid Debug Tool command.
Usage notes
- A constant as a reference is allowed only on the right side of the FROM and BY keywords.
- Index-names and floating point variables cannot be used as the VARYING references.
- Index-names are not supported in the BY phrase.
- Only inline PERFORMs are supported (but the performed command can be a Debug Tool procedure invocation).
- The COBOL AFTER phrase is not supported.
- Windowed date fields cannot be used as the VARYING reference, the FROM reference, or the BY reference.
- See Enterprise COBOL for z/OS Language Reference for
an explanation of the following COBOL keywords:
- AFTER
- BEFORE
- BY
- FROM
- TEST
- UNTIL
- VARYING
- WITH
- For optimized COBOL programs, the PERFORM command cannot reference any variable that was discarded by the optimizer.
- For optimized COBOL programs, if the VARYING phrase is specified, the first reference can only refer to a session variable.
- If the you entered the PLAYBACK ENABLED with
the DATA parameter and the compile unit supports
the DATA parameter, the PERFORM command
can reference a program variable and the VARYING operand
(if specified) must reference a session variable. For example:
PERFORM VARYING session-var-1 FROM program-var-1 BY program-var-2 UNTIL program-var-3 = program-var-4
Examples
- Set a breakpoint at statement number 10 to move the value of variable a to
the variable b and then list the value of x.
AT 10 PERFORM MOVE a TO b; LIST (x); END-PERFORM;
- List the value of height for each even value
between 2 and 30, including 2 and 30.
PERFORM WITH TEST AFTER VARYING height FROM 2 BY 2 UNTIL height = 30 LIST height; END-PERFORM;
- Position the cursor at the start of a COBOL performed paragraph and press PF5.
Refer to the following topics for more information related to the material discussed in this topic.
- Related references
- Enterprise COBOL for z/OS Language Reference