Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-82
PERFORM Statements
:
add-routine.
MOVE 0 to flag.
:
: Once the add routine is successful, a 1 is moved
: to flag; otherwise, flag remains 0. As long as
: flag is 0, the procedure is reexecuted.
:
delete-routine.
PERFORM VARYING Statement
The PERFORM VARYING statement executes a procedure, or group of procedures as
established by the THROUGH phrase, while varying a data item until specified
conditions are true. When AFTER phrases are specified, the range is within a nested
loop. The innermost loop is defined by the last AFTER phrase; the outermost loop is
defined by the first set of parameters in the VARYING clause. When execution
completes, control passes to the statement following the PERFORM VARYING
statement.
proc-1
and
proc-2
are the procedure paragraphs or sections to be executed.
vary-1
and
vary-2
are the identifiers of integer numeric data items.
base-1
and
base-2
are integer numeric literals or identifiers of numeric data items.
step-1
and
step-2
are integer numeric literals or identifiers of numeric data items. Their value must
not be zero.
cond-1
and
cond-2
are any conditional expressions.
The following example illustrates the PERFORM VARYING statement:
WORKING-STORAGE SECTION.
01 command-data.
05 FILLER PIC X(36) VALUE "ADD - ADD A NEW RECORD".
PERFORM
proc-1
[ { THROUGH }
proc-2
]
[ { THRU } ]
VARYING
vary-1
FROM
base-1
BY
step-1
UNTIL
cond-1
[ AFTER
vary-2
FROM
base-2
BY
step-2
UNTIL
cond-2
] ...