Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)


Section for use

All


Syntax

PROCESS_TOTAL ControlBreakGuideWord


Description

This instruction detects a control break at the total 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 instruction "PROCESS_TOTAL ControlBreakGuideWord", after detecting a control break, calls the section "TOTAL_PROCEDURE ControlBreakGuideWord" which has the same control break guide word. After executing this section, the program continues its execution after "PROCESS_TOTAL ControlBreakGuideWord".


A PROCESS_BRK must have been performed previously on the same control break.


The PROCESS_TOTAL instructions are generally placed after the reading of the view associated with the control break.


Important note: The total control breaks are detected in descending order within the same file.


Example

* Pgm to print orders/customer (1st brk on cust.code, 2nd 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

PRINT_VIEWS CUSTOMER_FMT

CUSTOMER_AMOUNT = 0

END_PROCESSING

BREAK_PROCEDURE WAREHOUSE_BK

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 following program allows to search and display in a graphic list

* the latest contract endorsement for a given customer


* Declare a cursor about a customer's CONTRACTS whose name is ZA_CUST_NAME

CURSOR CURS_CON_CUSNAM CONTRACT *COND(CU_CUST_NAME = :ZA_CUST_NAME) *SORT(CU_CONTRACT_NB, CU_CONT_UPD_NB *ASC)

...

* In the program, open cursor, read corresponding records

* then close

OPEN_SQL_C CURS_CON_CUSNAM

INIT_BREAK BRK_CONT_UPD

READ_NX_SQL_C CURS_CON_CUSNAM

DO_WHILE *SQLCODE = *NORMAL

PROCESS_BRK BRK_CONT_UPD

PRESENT CONTRACT

READ_NX_SQL_C CURS_CON_CUSNAM

PROCESS_TOTAL BRK_CONT_UPD

REDO

CLOSE_SQL_C CURS_CON_CUSNAM

...

* The field CNUM_CONTRAT defines the break in its DECLARATION paragraph

BREAK CU_CONTRACT_NB *SQL

...

* In the paragraph TOTAL_PROCEDURE of the break, a record is added into

* the graphical list LST_CONTRACT

INSERT_ELT WIN_CONT_SEL.LST_CONTRACT:LIST *END

* The added record is the one in the latest contract endorsement


↑ Top of page

  • Aucune étiquette