GOTO Examples


Example 1:

 

  

GOTO

READ1

 

The program branches to the Program Execution Label READ1 each time this instruction is executed.

 

Example 2:

 

  

GOTO

READRECD IF EQUAL

 

The program branches to the Program Execution Label READRECD only if the EQUAL or ZERO Condition Flag is set.

 

Example 3:

 

  

GOTO

READNEXT IF NOT EQUAL

 

The program branches to the Program Execution Label READNEXT only if the EQUAL or ZERO Condition Flag is not set (FALSE).

 

Example 4:

 

  

KEYIN

*P01:03,"ENTER NEXT REQUEST: ",REQUEST;

  

GOTO

ENDOFJOB IF F5

 

The program branches to the Program Execution Label ENDOFJOB if the F5 key (Function Flag) was set by its being pressed during the preceding KEYIN.

 

Example 5:

 

READRCD

READKS

GLMASTER;GLACCT,GLBALNCE

  

GOTO

EOJ IF OVER

  

COMPARE

"0" TO GLBALNCE

  

GOTO

READRCD IF EQUAL

  

PRINT

*5,GLACCT,*20,GLBALNCE

  

GOTO

READRCD

EOJ

STOP

 

 

The file GLMASTER is read in key sequence until the End Of File (EOF) is reached, at which time the OVER Condition Flag is set. Execution then shifts to the Program Execution Label EOJ. While NOT OVER (FALSE), the program COMPAREs GLBALNCE to ZERO. If the value is EQUAL (TRUE), execution shifts to READRCD. If the value is NOT EQUAL (FALSE), the data fields GLACCT and GLBALNCE are written to the printer and the execution unconditionally shifts to READRCD.

 

 



PL/B Language Reference GETPROP Examples IF Example