STOP

Terminate program execution

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
STOP [function]

function

(optional) One of the following termination functions to perform:

The STOP statement terminates program execution and passes control either to another program or the monitor.

If function is a program, it can be any executable program in Synergy .NET or on OpenVMS, but it must be a Synergy program compiled with the dbl compiler in traditional Synergy on Windows or Unix. If the program is a bound program, function must be the name specified with the -b or -p compiler option. (Bound programs are not supported on .NET.)

To chain to a command file, precede the command filename with an “at” sign (@) as follows:

stop "@filename"

or

stop "$@filename"
Note

When stopping to a program or command file, arguments cannot be passed. Use the EXEC subroutine instead.

To chain to a DCL command on OpenVMS, precede the command with a dollar sign ($) as follows:

stop "$command [arg1] [arg2] ..."

To execute a shell script on Unix, the first line must begin with #! or the script will not execute. For example:

#! /bin/bash

If you are using option #22 for LPQUE, make sure the first line of dblpq includes this line.

If function is not specified, no further program statements are executed, control returns to the operating system prompt, and D_EXIT_SUCCESS is returned. All I/O channels that are not closed before the STOP are purged.

Note

Even though the channel is purged, pending terminal input characters are not removed during a STOP chain. You must drain the buffer before stopping to another program. For example,

while %ttsts(chan) accept(chan, dvar)

If function is a name but is not found, a “File not found” error ($ERR_FNF) is generated.

System option #43 controls whether a Synergy application produces a stop message when a STOP statement is executed.

Windows platforms prevent exceptions from being thrown across the kernel (user32.dll) boundary. This means that a Windows callback (for example, a .NET assembly API delegate called from a WinForm or an ActiveX event called from a UI control) cannot perform a STOP chain. If a Windows callback attempts to perform a STOP chain, the runtime generates an $ERR_NOCHAIN error.

Chaining to a program with the STOP statement in Synergy .NET and causes a delay when the new program is started, and any on-screen data is cleared and recreated, which may cause flicker. We recommend that you avoid chaining with Synergy .NET. The same problem occurs on OpenVMS, unless you use a bound chain.

The following example returns an error status to the operating system (on Unix).

stop 1

The following example chains to the rpt.dbr program and the cleanup command file, respectively.

stop "rpt"
stop "@cleanup"