Previous Topic: PRINT Control StatementNext Topic: SELECT Control Statement


RELEASE Control Statement

The RELEASE control statement signals the construction and release of a sort record to the sort. The data released to the sort depends on the current values of database fields and defined fields. The RELEASE control statement is only allowed in logic before the sorting (statements preceding the SORT control statement).

The RELEASE control statement helps reduce the number of records that are released to the sort and to allow sorting of iterative fields, such as TEXT (report text line), INST (report instruction line), BINST (bundle instruction line), and A (distribution address line).

If the logic before the sorting drops through to the SORT control statement, an implied release is assumed.

Note: When coding the RELEASE control statement, avoid the release of identical information.

Syntax

RELEASE

Example

The following example restricts the sort selection to production jobs by interrogating the first four positions of the programmer name.

/DO FOREVER
/   IF SUBSTR(PGMRNAME,1,4) = 'PROD'
/      RELEASE
/   END
/NEXT RECORD
/END
/SORT ID
/PRINT ID
/PRINT ARCHDATE
/PRINT ARCHTIME
/PRINT PGMRNAME
/END

The previous example shows the use of the RELEASE control statement. In most cases, complex logic as in that example is not needed. Selection of production jobs that start with PROD can be performed much easier using the SELECT control statement as follows.

/SELECT SUBSTR(PGMRNAME,1,4) = 'PROD'
/SORT ID
/PRINT ID
/PRINT ARCHDATE
/PRINT ARCHTIME
/PRINT PGMRNAME
/END