HP 3000 Manuals

PERFORM [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation


HP Transact Reference Manual

PERFORM 

Transfers control to a labeled statement.

Syntax 

PERFORM label;

PERFORM transfers execution to the statement identified by label.
Execution continues until one of the following is encountered:

RETURN     Returns control to the statement immediately following the
           corresponding PERFORM statement.

END        Specifies the end of the current processing level and returns
           control to the previous processing level, or to command level
           if no previous processing level is active within the perform
           block.

another    Specifies the end of the current command sequence.  The
label      compiler generates an END statement and the effect is the same
           as END.

PERFORM statements can be nested up to a maximum of 75 levels.  Note that
this differs from PERFORM= options in data management verbs, which allow
a maximum of 10 levels of nesting.  Although GO TO statements can branch
into and out of PERFORM statement loops, this is not generally good
coding practice.

Statement Parts 

label      The label that identifies the sequence of statements called by
           PERFORM.

Examples 

When the response to INPUT causes a transfer to the label ADD-IT, the
statements between ADD-IT and RETURN execute.  Control then returns to
the PROMPT statement that immediately follows the IF statement.

     IF INPUT = "YES", "Y" THEN
        PERFORM ADD-IT
     ELSE GO TO GET-ACCT;
     PROMPT INV-NUM("Invoice Number"), RIGHT;
     :
     END;
     ADD-IT:
        PUT CUST-FILE, LIST=(NAME:ZIP);
        LET (NUM) = (NUM) + 1;
        DISPLAY NAME, COL=5, NOHEAD:
                "HAS BEEN ADDED TO CUSTOMER FILE.", JOIN;
     RETURN;



MPE/iX 5.0 Documentation