RELEASE

#### Search Results

Search

# RELEASE

|  | `STACK` |
`RELEASE` | `SETS` [set-name]
| `VARIABLES`

This document covers the following topics:

- Function

- Syntax Description

- Example

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: `STACK` | `FIND` with `RETAIN` option | `DEFINE DATA GLOBAL`

## Function

The `RELEASE` statement is used to:

- delete the entire contents of the Natural stack;

- release sets of ISNs retained via a `FIND` statement that contained a `RETAIN` clause (applicable to Adabas databases only);

- reset global and application-independent variables.

## Syntax Description

Operand Definition Table:

Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition
--- | --- | --- | --- | ---
`set-name` | C | S |  |  |  | A |  |  |  |  |  |  |  |  |  |  |  | no | no

Syntax Element Description:

Syntax Element | Description
--- | ---
`RELEASE STACK` | RELEASE STACK Option: Causes all data/commands currently in the Natural stack to be deleted.
`RELEASE SETS` | RELEASE SETS Option: Is applicable to Adabas databases only. If only `RELEASE SETS`, without a `set-name`, is specified, all ISN sets retained with a `FIND` statement with a `RETAIN` clause will be released.
`RELEASE SETS set-name` | Causes a specific single ISN set to be released.
    RELEASE SET 'CITY-SET'

    MOVE 'CITY-SET' TO #SET(A32)
    RELEASE SET #SET
`RELEASE VARIABLES` | RELEASE VARIABLES Option: Causes all variables defined in the current global data area (GDA) to be reset to their initial values. Also, it eliminates all application-independent variables (AIVs), thus making them no longer available. The `RELEASE VARIABLES` statement does not perform the reset/eliminate operations directly after execution. Instead, a signal is set first which triggers these operations when all Natural objects currently running have finished processing.

## Example

    ** Example 'RELEX1': FIND (with RETAIN clause and RELEASE statement)
    ************************************************************************
    DEFINE DATA LOCAL
    1 EMPLOY-VIEW VIEW OF EMPLOYEES
      2 CITY
      2 BIRTH
      2 NAME
    *
    1 #BIRTH (D)
    END-DEFINE
    *
    MOVE EDITED '19400101' TO #BIRTH (EM=YYYYMMDD)
    *
    FIND NUMBER EMPLOY-VIEW WITH BIRTH GT #BIRTH
         RETAIN AS 'AGESET1'
    IF *NUMBER = 0
      STOP
    END-IF
    *
    FIND EMPLOY-VIEW WITH 'AGESET1' AND CITY = 'NEW YORK'
      DISPLAY NOTITLE NAME CITY BIRTH (EM=YYYY-MM-DD)
    END-FIND
    *
    RELEASE SET 'AGESET1'
    *
    END

#### Output of Program RELEX1:

    NAME                 CITY            DATE
                                                  OF
                                                BIRTH
    -------------------- -------------------- ----------

    RUBIN                NEW YORK             1945-10-27
    WALLACE              NEW YORK             1945-08-04

### On this page

- Function
- Syntax Description
- Example