BRANCH


ANSI

 

The BRANCH instruction alters the program execution sequence to a specific Program Execution Label based on an index value. The instruction uses the following format:

 

 

[label]

BRANCH

{index}{sep}{targets}

 

Where:

label

Optional. A Program Execution Label.

index

Required. A previously defined Numeric Variable or Expression that selects the new Program Execution Label.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

targets

Required. A list of Program Execution Label from which a new program address is selected.

Flags Affected: NONE

Note the following:

  1. The value of {index} remains unchanged and designates Program Execution Label in {labels} the program execution is to shift. If the value is one, program execution changes to the first Program Execution Label in {labels}. If the value is two, program execution changes to the second label in {labels}, etc.

  2. If {index} has a negative value, a zero value or a value greater than the number of Program Execution Labels in {labels}, control is passed to the next sequential instruction.

  3. The number of Program Execution Labels in {labels} is limited to 2047. Additional lines may be used by ending each continued line with a colon (:).

  4. If {index} is not a decimal integer, only the integer portion of the variable is used. For example, if it has a value of 3.6, it is 3.

  5. If a FILEPI instruction is active, the FILEPI count is not decremented by this instruction.

  6. Null entries in the list are allowed and are signified by two consecutive commas. When the index value is associated with a null entry, no BRANCH operation is performed just as when the index value is out of range or invalid.

 

 

See Also: Example Code, BRANCHF, PERFORM, Program Control Instructions

 



PL/B Language Reference Trappable Events BRANCHF