SETFLAG Examples


Example 1:

 

A

FORM

2

  

KEYIN

"ENTER A: ",A;

  

IF

( A < 1 )

  

SETFLAG

OVER

  

ENDIF

 

  

RETURN

 

 

The OVER flag is set if a value less than '1' is entered into A. The CALLing routine could then check for the OVER flag to indicate an error condition.

 

Example 2:

 

NDX

FORM

2

  

KEYIN

"Index Value: ",NDX;

  

IF

F1

  

MOVE

"-1",NDX

  

SETFLAG

F1

  

ENDIF

 

 

If the KEYIN is terminated with an F1 key, the value of NDX is set to -1 butthe F1 flag still needs setting for the return. Testing for F1 clears it if set. Therefore, F1 must be set again. The calling routine could then check for the F1 flag.

 



PL/B Language Reference SET Examples SETFOCUS Example