Since LIST PANEL does not automatically cause pagination, several logical reports can be generated on one physical page. For example, assume a customer inquiry report should contain information about all customers in Texas. The inquiry is actually in two parts‑first, general information from the CUSTOMER table and, second, a list of outstanding orders, if any.
Two panels are created to correspond to a preprinted form: The CUST‑INQ panel displays the general customer information and the ORD‑INQ panel displays a list of orders. Since a repeating group is used in the ORD‑INQ panel to display the order list, the panel is populated before it is listed. You do not need to list the panels in the same program. In fact, the ORD‑INQ panel is listed from a subprogram called GETORD. To specify which orders are retrieved, the CUSTOMER.CUSTID is passed as a parameter to GETORD. Pagination (that is, LIST NEWPAGE) occurs in the main program to force a new page for each customer:
<<CUST‑RPT>> PROCEDURE
FOR EACH CUSTOMER
WHERE CUSTOMER.STATE EQ 'TX'
MOVE CUSTOMER TO CUST‑INQ BY NAME
LIST PANEL CUST‑INQ
CALL GETORD INPUT CUSTOMER.CUSTID
LIST NEWPAGE
WHEN NONE
LIST 'THERE ARE NO CUSTOMERS IN TEXAS ON FILE'
ENDFOR
ENDPROC
The GETORD program contains the following code:
<<ORD‑RPT>> PROCEDURE
SET PNL‑IDX = 1
FOR FIRST 20 ORDER
WHERE ORDER.CUSTID EQ CUSTOMER.CUSTID
MOVE ORDER TO ORD‑INQ.ORDINF(PNL‑IDX) BY NAME
SET PNL‑IDX = PNL‑IDX + 1
WHEN NONE
SET ORD‑INQ.MSG = 'NO ORDERS'
ENDFOR
LIST PANEL ORD‑INQ
The subprogram GETORD limits the number of orders to the size of a fixed length panel.
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|