Natural for OpenVMS Version 6.3.12 for OpenVMS
 —  Statements  —

BEFORE BREAK PROCESSING

Structured Mode Syntax

BEFORE [BREAK] [PROCESSING]
   statement ../graphics/dot3.gif
END-BEFORE

Reporting Mode Syntax

[BEFORE [BREAK] [PROCESSING]

statement

DO statement ../graphics/dot3.gif DOEND

This document covers the following topics:

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


Function

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

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:

Top of page

Restrictions

Top of page

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

Top of page

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

Top of page