ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(I) (C/S) |
Section for use
All
Syntax
PROCESS_BRK ControlBreakGuideWord
Description
This instruction detects a control break at the heading level and involves the execution of the procedure associated with the control break.
This control break must be created in the prototype and is specified by its guide word ControlBreakGuideWord after the instruction.
The "PROCESS_BRK ControlBreak" instruction, after detecting a control break, calls the section "BREAK_PROCEDURE ControlBreak" which has the same control break guide word. After executing this section, the program continues its execution after "PROCESS_BRK ControlBreak".
Important note: The detection of these control breaks is done in ascending order within the same file.
Example
* Batch program to print orders per customer
* (First break on customer code, second on warehouse code)
READ ORDER
DO_WHILE ORDER EXISTS
PROCESS_BRK CUSTOMER_BK
PROCESS_BRK WAREHOUSE_BK
WAREH_AMOUNT = WAREH_AMOUNT + LINE_AMOUNT
PRINT_VIEWS ORDER_LINE
READ ORDER
PROCESS_TOTAL WAREHOUSE_BK
PROCESS_TOTAL CUSTOMER_BK
REDO
*
* |
Heading procedures |
*
BREAK_PROCEDURE CUSTOMER_BK
CHAIN CUSTOMERS
PRINT_VIEWS CUSTOMER_FMT
CUSTOMER_AMOUNT = 0
END_PROCESSING
*
BREAK_PROCEDURE WAREHOUSE_BK
CHAIN WAREHOUSES
PRINT_VIEWS WAREHOUSE_FMT
WAREHOUSE_AMOUNT = 0
END_PROCESSING
*
* |
Total procedures |
*
TOTAL_PROCEDURE WAREHOUSE_BK
PRINT TOTAL_WAREH
CUSTOMER_AMOUNT = CUSTOMER_AMOUNT = WAREH_AMOUNT
END_PROCESSING
*
TOTAL_PROCEDURE CUSTOMER_BK
PRINT TOTAL_CUST
END_PROCESSING
Other example:
* Visual Adelia context
* The program below allows to search and display in a graphic list the latest
* contract endorsements for a given customer
* Declare a cursor about CONTRACTS for a customer whose name is ZA_CUST_NAME
CURSOR CURS_CON_CUSNAM CONTRACT *COND(CU_CUST_NAME = : ZA_CUST_NAME) *SORT(CU_CONTRACT_NB, CU_CON_UPD_NB *ASC)
...
* In the program, open cursor, read corresponding records
* then close
OPEN_SQL_C CURS_CON_CUSNAM
INIT_BREAK BRK_UPD_CONTRACT
READ_NX_SQL_C CURS_CON_CUSNAM
DO_WHILE *SQLCODE = *NORMAL
PROCESS_BRK BRK_UPD_CONTRACT
PRESENT CONTRACT
READ_NX_SQL_C CURS_CON_CUSNAM
PROCESS_TOTAL BRK_UPD_CONTRACT
REDO
CLOSE_SQL_C CURS_CON_CUSNAM
...
* CU_CONTRACT_NB define a break in the DECLARATION paragraph
BREAK CU_CONTRACT_NB *SQL
...