# SWXTERM (Terminate REXXTOOLS)

## Syntax:

    SWXTERM()

## Arguments:

None.

## Module Name:

SWXTERM

## Service Description:

The SWXTERM function is used remove a Shadow REXXTOOLS environment from the current MVS task. In addition to freeing Shadow REXXTOOLS data structures, the following actions are performed:

- All files opened by the REXXTOOLS access method functions are closed.
- Any open connection to DB2 is terminated.
- Any global variables you may have defined are discarded.

In most cases, the SWXTERM function is not required (see note 1 below). Open Software recommends that you use SWXTERM only if your execution environment requires you to do so.

Notes:

1. A Shadow REXXTOOLS environment is established on the first call to a Shadow REXXTOOLS function or host command. Certain data structures remain allocated until task termination. In some environments the subpool used for REXXTOOLS storage allocations may be shared with parent tasks. When the subpool is shared, storage is not freed at task termination. Repeated use of REXXTOOLS facilities in an environment of this type may cause storage to be depleted. The SWXTERM function should be used in this situation to force all REXXTOOLS-related storage to be freed.
2. Storage allocated by the GETMAIN function is not released by SWXTERM. You must free this storage yourself (see FREEMAIN function).
3. At this time, the only environment that is known to require the use of SWXTERM is Boole & Babbage's Auto Operator product.

## Returned Information:

The SWXTERM function returns a return code that indicates the success of the operation. If you CALL the SWXTERM function, the returned value is contained in the RESULT special variable. The RC special variable is unchanged.

The following SWXTERM return code values are possible:

0
  The environment was found and successfully removed.
4
  No Shadow REXXTOOLS environment was found. A message is issued.
16
  The Shadow REXXTOOLS anchor block has been corrupted. Environment termination is not possible. A message is issued.

## Examples:

1. Terminate the Shadow REXXTOOLS environment:

       call SWXTERM

© Copyright 1998 by Open Software Technologies, Inc.