Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Procedure Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
6-56
PERFORM Statements
01 command-table REDEFINES command-data.
05 command-entry PIC X(36) OCCURS 10 TIMES.
77 no-of-commands PIC 99 VALUE 9.
77 command-index PIC 99 VALUE 1 COMP.
PROCEDURE DIVISION.
:
PERFORM list-commands VARYING command-index FROM 1 BY 1
UNTIL command-index GREATER THAN no-of-commands.
list-commands.
:
PERFORM ONE Statement
The PERFORM ONE statement executes just one procedure, or one group of procedures
as established by the THROUGH phrase, as determined by the value of an identifier.
proc-1 and proc-2
are the procedure paragraphs or sections to be executed; the maximum is 255
paragraphs.
identifier
is an integer numeric literal or the identifier of an integer data item. The value
determines which procedure, or group of procedures, is to be performed.
Each procedure, or group of procedures, in the list is assigned an index value that
indicates the relative position of the procedure, or group of procedures, within the list.
The index values begin at 1 and increment by 1, up to 255; the list cannot contain more
than 255 procedures or groups of procedures.
If the value of the identifier matches one of these indexes, the procedure, or group of
procedures, with that index is executed. When execution completes, control passes to
the statement following the PERFORM ONE statement. If the value of identifier
does not match any procedure index, no procedures are executed.
The following example illustrates the PERFORM ONE statement:
PERFORM ONE OF
A THRU B
C
D
DEPENDING ON I.
PERFORM ONE [ OF ] { proc-1 [ { THROUGH } proc-2 ] } ,...
{ [ { THRU } ] }
DEPENDING [ ON ] identifier