PERFORM BREAK PROCESSING

PERFORM BREAK [PROCESSING] [(r)]
  AT BREAK statement

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 | BEFORE BREAK PROCESSING | DELETE | END TRANSACTION | FIND | GET | GET SAME | GET TRANSACTION DATA | HISTOGRAM | LIMIT | PASSW | READ | RETRY | STORE | UPDATE

Belongs to Function Group: Database Access and Update


Function

The PERFORM BREAK PROCESSING statement is used to establish break processing in loops created by FOR, REPEAT, CALL LOOP and CALL FILE statements where no automatic break processing is established, or whenever a user-initiated break processing is desired. Unlike automatic break processing which is executed immediately after the record is read, the PERFORM BREAK PROCESSING statement is executed when it is encountered in the normal flow of the program.

This statement causes a check for a break processing condition (based on the value of a control field) and also results in the evaluation of Natural system functions. This check and system function evaluation are performed each time the statement is encountered for execution. This statement may be executed depending on a condition specified in an IF statement.

Syntax Description

Syntax Element Description
(r)
Statement Reference Notation:

By default, the final PERFORM BREAK condition is true at the end of execution of the program, subprogram or subroutine.

The notation (r) may be used to relate the final processing of a PERFORM BREAK to a specific loop. In this case the PERFORM BREAK is executed in the loop end handling of this loop; after the final automatic BREAK processing and before the AT END OF DATA statements are executed.

AT BREAK statement...

See the syntax of the AT BREAK statement.

Example

** Example 'PBPEX1S': PERFORM BREAK PROCESSING  (structured mode)       
************************************************************************
DEFINE DATA LOCAL                                                       
1 #INDEX (N2)                                                           
1 #LINE  (N2) INIT <1>                                                  
END-DEFINE                                                              
*                                                                       
FOR #INDEX 1 TO 18                                                      
  PERFORM BREAK PROCESSING                                             
  /*                                                                    
  AT BREAK OF #INDEX /1/                                                
    WRITE NOTITLE / 'PLEASE COMPLETE LINES 1-9 ABOVE' /                 
    RESET INITIAL #LINE                                                 
  END-BREAK                                                             
  /*                                                                    
  WRITE NOTITLE '_' (64) '=' #LINE                                      
  ADD 1 TO #LINE                                                        
END-FOR                                                                 
*                                                                       
END

Output of Program PBPEX1S:

________________________________________________________________ #LINE:   1
________________________________________________________________ #LINE:   2
________________________________________________________________ #LINE:   3
________________________________________________________________ #LINE:   4
________________________________________________________________ #LINE:   5
________________________________________________________________ #LINE:   6
________________________________________________________________ #LINE:   7
________________________________________________________________ #LINE:   8
________________________________________________________________ #LINE:   9
                                                                           
PLEASE COMPLETE LINES 1-9 ABOVE                                            
                                                                           
________________________________________________________________ #LINE:   1
________________________________________________________________ #LINE:   2
________________________________________________________________ #LINE:   3
________________________________________________________________ #LINE:   4
________________________________________________________________ #LINE:   5
________________________________________________________________ #LINE:   6
________________________________________________________________ #LINE:   7
________________________________________________________________ #LINE:   8
________________________________________________________________ #LINE:   9
                                                                           
PLEASE COMPLETE LINES 1-9 ABOVE

Equivalent reporting-mode example: PBPEX1R.