LABEL


9.5B

 

The LABEL data definition declares an program execution label pointer that can be changed when a PLB program is executing. Program Control instructions can use the [label] name reference for the LABEL variable in place of normal Program Execution Label references. The statement uses one of the following formats:

 

label

LABEL

{^|@}

 

Where:

label

Required. A Data Definition Label.

^

Required. Identifies the label as a pointer.

@

Optional. Identifies the label as a global pointer.

Flags Affected: NONE

Note the following:

  1. The LABEL variable is a pointer that can be assigned to the address of a Program Execution label reference.

  2. See the descriptions for the following instructions regarding the use/manipulation of the LABEL variable: CLEARLABEL, GETLABEL, LOADLABEL, MOVELABEL, MOVELV, MOVEVL, STORELABEL, TESTLABEL, and VERB (User defined verb).

  3. The following Program Control Instructions can use the LABEL variable: BRANCH, BRANCHF, CALL, GOTO, PERFORM, PERFORMF, EXCEPTSET and TRAP.

  4. The LABEL variable cannot be used in an EVENTREGISTER instruction. In this case, a compiler error occurs.

  5. The LABEL variable cannot be declared as a Common or Global variable.

  6. The label name reference for a LABEL pointer is mapped into the Program Execution labels. The LABEL pointer cannot be specified in a CALL USING variable list or a LROUTINE, ROUTINE, or PROCEDURE parameter variable list.

  7. An execution LABEL pointer can not be declared within the scope of a LFUNCTION/FUNCTIONEND or FUNCTION/FUNCTIONEND.

  8. When normal program flow control instructions are being used, an execution LABEL pointer can be passed as a parameter using a typeless VAR variable:

    Example: 

  9.  

    VAR1 VAR ^

    .

             DISPLAY "Pass Execution Program label as parameter!"

             MOVELV ProgLabel, VAR1

             CALL ExeLabel USING VAR1

             KEYIN "Hit enter to exit...:",S$CMDLIN

             SHUTDOWN

    .

    LABx LABEL ^

    VARx VAR ^

    ExeLabel ROUTINE VARx

    .

             MOVEVL VARx, LABx

             CALL LABx

             RETURN

    .

    ProgLabel

             DISPLAY "ProgLabel is doing something!"

             RETURN

 

 

See Also: Data Definitions

 



PL/B Language Reference INTEGER LIST and LISTEND