STOP and DETACH


ANSI

 

The STOP instruction provides a method for terminating a program's execution. Depending upon how the terminating program was initiated, STOP returns control to the MASTER program or to the operating system. DETACH (non-ANSI) may be used instead of STOP. It uses one of the following formats:

 

(1)

[label]

STOP

 

(2)

[label]

STOP

[IF [NOT] {flag}]

(3)

[label]

STOP

[IF [NOT] {expression}]

 

Where:

label

Optional. A Program Execution Label.

flag

Required. One of the condition or function Flags that determines whether the STOP or DETACH will occur.

expression

Required. An Expression that, if true, causes the program to stop execution.

Flags Affected: Function Key

Note the following:

  1. Under SUNDB86, if a program named ANSWER is executed directly from the MS-DOS prompt and it executes a STOP instruction, it attempts to chain to a program named MASTER. If unable to do so, it returns to the operating system.

  2. Under PLBCMP, if the program defined in the screen definition file as the answer program is executed directly from the Linux prompt and it executes a STOP instruction, it attempts to chain to the program defined in the screen definition file as the master program. If unable to do so, it returns to the operating system.

  3. Under SUNDB86, any program executed directly from the operating system prompt not named ANSWER becomes both the ANSWER and MASTER program for any subsequent programs. If this program executes a STOP instruction, it returns control to the operating system.

  4. Under PLBCMP, any program executed directly from the operating system prompt not defined in the screen definition file as the answer program becomes both the ANSWER and MASTER program for any subsequent programs. If this program executes a STOP instruction, it returns control to the operating system.

  5. Any chained program that executes a STOP instruction attempts to CHAIN to its MASTER program. If unable to do so, an attempt is made to CHAIN to its ANSWER program. If still unable to do so, it returns control to the operating system.

  6. See CHAIN for more information on the ANSWER/MASTER concept of program chaining.

  7. Format (2) performs a STOP only if {flag} is as specified, set or not set (FALSE). Otherwise, execution continues with the next sequential instruction.

  8. Format (3) performs a STOP only if {expression} evaluates to a true condition. Otherwise, execution continues with the next sequential instruction.

  9. If a FILEPI instruction is active, the FILEPI count is not decremented by the conditional form of this instruction if the condition was not met.

  10. If a FILEPI instruction is active, it is terminated by the unconditional form of this instruction or the conditional form of this instruction if the condition was met.

 

 

See Also: CHAIN, DSCNCT, Program Control Instructions

 



PL/B Language Reference SETFLAG SWITCH