Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Using PAGEMODE

Example: Breakpoint Report

Scroll Prev Top Next More

This is an example of a breakpoint report with multiple breaks printed per page. The break heading is repeated on the next page if the data for the break does not fit on the page. The report prints a page header as well as a break header and break footer.

 

*(PHONE3.RMD)

*(example 3 - this example includes a page header

 along with the break header. Multiple breaks are

 printed per page. The break header is repeated on

 subsequent pages if the break detail spans a page)

DEL phone.out

CON hifi

CLS

SET MESSAGE OFF

SET PAGEMODE OFF

SET LINES 25

SET VAR vState TEXT

DECLARE c1 CURSOR FOR SELECT DISTINCT state +

 FROM salespeople

DECLARE c2 CURSOR FOR +

 SELECT (LastName + ',' & FirstName), Phone, Lastname +

 FROM salespeople WHERE state = .vState +

 ORDER BY lastname

SET VAR vCol INT = 3, +

       vRow INT = 2, +

       vPage INT = 1, +

       vPageLimit = (CVAL('lines')), +

       vCount INT = 0

SET PAGEMODE ON

OUTPUT phone.out

WRITE 'Employee Phone List by State' AT .vRow, 25

SET VAR vRow = (.vRow + 1)

WRITE .#date AT .vRow, 32

WRITE 'Page:', .VPage AT .vRow, 60

SET VAR vRow = (.vRow + 2)

OPEN c1

FETCH c1 INTO vState ii1

WHILE SQLCODE <> 100 THEN

 WRITE 'List of employees in state of:', .VState +

   AT .vRow, .VCol

 SET VAR vRow = (.vRow + 1)

 WRITE '----------------------------------' +

   AT .vRow, .vCol

 OPEN c2

 FETCH c2 INTO vName i1 ,vPhone i2, vLastname i3

 WHILE SQLCODE <> 100 THEN

   SET VAR vRow = (.vRow + 1)

   SET VAR vCount = (.vCount + 1)

   IF vRow >= .vPageLimit THEN

     NEWPAGE

     SET VAR vRow = 2, vPage = (.vPage + 1)

     WRITE 'Employee Phone List by State' +

       AT .vRow, 25

     SET VAR vRow = (.vRow + 1)

     WRITE .#date AT .vRow, 32

     WRITE 'Page:', .vPageAT .vRow, 60

     SET VAR vRow = (.vRow + 2)

     WRITE 'List of employees in state of:', .VState +

       AT .vRow, .VCol

     SET VAR vRow = (.vRow + 1)

     WRITE '----------------------------------' +

       AT .vRow, .vCol

     SET VAR vRow = (.vRow + 1)

   ENDIF

   WRITE .vName=21 .vPhone AT .vRow .vCol

   FETCH c2 INTO vName i1, vPhone i2, vLastname i3

 ENDWH

 CLOSE c2

 SET VAR vRow = (.vRow + 2)

 WRITE 'Number of employees for', .vState, 'is', +

   .vCount AT .vRow, 10

 SET VAR vRow = (.vRow + 3), vCount = 0

 FETCH c1 INTO vState ii1

ENDWH

OUTPUT screen

DROP CURSOR c1

DROP CURSOR c2

SET PAGEMODE OFF

SET LINES 20

TYPE phone.out