BEFORE BREAK PROCESSING

#### Search Results

Search

# BEFORE BREAK PROCESSING

#### Structured Mode Syntax

`BEFORE` [`BREAK`] [`PROCESSING`]
statement
`END-BEFORE`

#### Reporting Mode Syntax

`BEFORE` [`BREAK`] [`PROCESSING`]
| statement |
`DO` statement `DOEND`

This document covers the following topics:

- BEFORE BREAK PROCESSING Usage

- BEFORE BREAK PROCESSING Restrictions

- BEFORE BREAK PROCESSING Syntax Description

- BEFORE BREAK PROCESSING Example

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

Related Statements: `ACCEPT/REJECT` | `AT BREAK` | `AT START OF DATA` | `AT END OF DATA` | `BACKOUT TRANSACTION` | `DELETE` | `END TRANSACTION` | `FIND` | `GET` | `GET SAME` | `GET TRANSACTION` | `HISTOGRAM` | `LIMIT` | `PASSW` | `PERFORM BREAK PROCESSING` | `READ` | `RETRY` | `STORE` | `UPDATE`

Belongs to Function Group: Database Access and Update

## BEFORE BREAK PROCESSING Usage

The `BEFORE BREAK PROCESSING` statement may be used in conjunction with automatic break processing to perform processing:

- before the value of the break control field is checked;

- before the statements specified with an `AT BREAK` statement are executed;

- before Natural system functions are evaluated.

This statement is most often used to initialize or compute values of user-defined variables which are to be used in break processing (see `AT BREAK` statement).

This statement is non-procedural (that is, its execution depends on an event, not on where in a program it is located).

See also the following sections in the Programming Guide:

- Control Breaks

- BEFORE BREAK PROCESSING Statement

- Example of BEFORE BREAK PROCESSING Statement

## BEFORE BREAK PROCESSING Restrictions

- The `BEFORE BREAK PROCESSING` statement may only be used with a processing loop that has been initiated with one of the following statements:

  - `FIND`

  - `READ`

  - `HISTOGRAM`

  - `SORT`

  - `READ WORK FILE`

  It may be placed anywhere within the processing loop and is always related to the processing loop in which it is contained. Only one `BEFORE BREAK PROCESSING` statement may be specified per processing loop.

- The `BEFORE BREAK PROCESSING` statement must not be used in conjunction with the statement `PERFORM BREAK PROCESSING`.

## BEFORE BREAK PROCESSING Syntax Description

Syntax Element | Description
--- | ---
`statement...` | Statement(s) for Break Processing: In place of `statement`, you must supply one or several suitable statements, depending on the situation. For an example of a statement, see Example below. If no break processing is to be performed (that is, no `AT BREAK` statement is specified for the processing loop), any statements specified with a `BEFORE BREAK PROCESSING` statement will not be executed.
`END-BEFORE` | End of BEFORE BREAK PROCESSING Statement: In structured mode, the Natural reserved word `END-BEFORE` must be used to end the `BEFORE BREAK PROCESSING` statement. In reporting mode, use the `DO ... DOEND` statements to supply one or several suitable statements, depending on the situation, and to end the `BEFORE BREAK PROCESSING` statement. If you specify only a single statement, you can omit the `DO ... DOEND` statements. With respect to good coding practice, this is not recommended.
`statement ...` `DO statement ... DOEND`

## BEFORE BREAK PROCESSING Example

    ** Example 'BBPEX1': BEFORE BREAK PROCESSING
    ************************************************************************
    DEFINE DATA LOCAL
    1 EMPLOY-VIEW VIEW OF EMPLOYEES
      2 CITY
      2 NAME
      2 SALARY (1)
      2 BONUS  (1,1)
    *
    1 #INCOME  (P11)
    END-DEFINE
    *
    LIMIT 7
    READ EMPLOY-VIEW BY CITY = 'L'
      /*
     BEFORE BREAK PROCESSING
        COMPUTE #INCOME = SALARY (1) + BONUS (1,1)
      END-BEFORE
      /*
      AT BREAK OF CITY
        WRITE NOTITLE  'AVERAGE INCOME FOR' OLD (CITY) 20X AVER(#INCOME) /
      END-BREAK
      /*
      DISPLAY CITY 'NAME' NAME 'SALARY' SALARY (1) 'BONUS' BONUS (1,1)
    END-READ
    END

#### Output of Program BBPEX1:

            CITY                 NAME           SALARY     BONUS
    -------------------- -------------------- ---------- ----------

    LA BASSEE            HULOT                    165000      70000
    AVERAGE INCOME FOR LA BASSEE                                     235000

    LA CHAPELLE ST LUC   GUILLARD                 124100      23000
    LA CHAPELLE ST LUC   BERGE                    198500      50000
    LA CHAPELLE ST LUC   POLETTE                  124090      23000
    LA CHAPELLE ST LUC   DELAUNEY                 115000      23000
    LA CHAPELLE ST LUC   SCHECK                   125600      23000
    LA CHAPELLE ST LUC   KREEBS                   184550      50000
    AVERAGE INCOME FOR LA CHAPELLE ST LUC                            177306

### On this page

- BEFORE BREAK PROCESSING Usage
- BEFORE BREAK PROCESSING Restrictions
- BEFORE BREAK PROCESSING Syntax Description
- BEFORE BREAK PROCESSING Example