not updated for File_number vs recnum support. This should not be used with VDF. See Enter command for notes
#CHECK !1.RECNUM _UVCWGL INTEGER RECCOUNT #SET P$ 0 // MOVEINT 20000 TO LINECOUNT // start with a full page !A [] $82 |CI20000 |VI10 // MOVE 0 TO RECCOUNT !A [] $82 |CI0 RECCOUNT // BREAKINIT // init breakpoints !A [] $207 // INDICATE FIRSTREC TRUE // used for subtotals #IFDEF FIRSTREC #ELSE #REPLACE FIRSTREC |!C #ENDIF !A [] $4028 |CI0 |CI0 FIRSTREC~ #IFSAME !2 BY FIND GE !1 BY !3 // FIND first record #ELSE FIND LE !1 BY !3 #ENDIF [~FOUND] GOTO END$OF$REPORT // CLEARSCREEN // start with a clear screen !A [] $144 RPT.LOOP:// INDICATE SELECT TRUE // default for SELECT #IFDEF SELECT #ELSE #REPLACE SELECT |!C #ENDIF !A [] $4028 |CI0 |CI0 SELECT~ // GOSUB RPT.SELECTION // go to user selection !A [] $42 |CL0 #FREF RPT.SELECTION !a //[NOT SELECT] GOTO RPT.CONT // test SELECT !A [~ SELECT] $41 |CL0 #FREF RPT.CONT !a BREAK$ !5 !6 !7 !8 !9 // set breakpoints #SET X$ !p // set up to break down [NOT FIRSTREC] BREAK$DOWN RPT.SUBTOTAL // break down for SUBTOTAL #SET X$ 0 // set up to break up // RELATE !1 // get related records !A [] $C4 !1.RECNUM BREAK$UP RPT.SUBHEADER // break up for SUBHEADER // INCREMENT RECCOUNT !A [] $083 RECCOUNT |CI0 // GOSUB RPT.BODY // print body !A [] $42 |CL0 #FREF RPT.BODY !a // INDICATE FIRSTREC FALSE // not first any more !A [] $4028 |CI0 |CI0 FIRSTREC RPT.CONT: #IFSAME !2 BY FIND GT !1 BY !3 // FIND next record #ELSE FIND LT !1 BY !3 #ENDIF // KEYCHECK // check keyboard !A [] $46 //[FOUND NOT KEYPRESS] GOTO RPT.LOOP // if ok, loop !A [FOUND ~ KEYPRESS] $41 RPT.LOOP //[KEYPRESS] GOSUB RPT.KEYPRESS // user can disable KEYPRESS !A [FOUND KEYPRESS] $42 |CL0 #FREF RPT.KEYPRESS !a !A [FOUND ~ KEYPRESS] $41 RPT.LOOP #SET X$ !p // set up for break down END.OF.REPORT: [~ FIRSTREC] BREAK$DOWN RPT.SUBTOTAL $X // break down for last subtotals //[FIRSTREC] GOSUB RPT.TOTAL // print TOTAL !A [~ FIRSTREC] $42 |CL0 #FREF RPT.TOTAL !a // GOTO END$OF$REPORT // GOTO end !A [] $41 |CL0 #FREF END$OF$REPORT !a NEWPAGE:// GOSUB RPT.HEADER // new page, print HEADER !A [] $42 |CL0 #FREF RPT.HEADER !a #SET X$ 0 // this will reprint the page headers if included // [NOT FIRSTREC] BREAK$PRT SUBHEADER // reprint pages // RETURN // end of NEWPAGE !A [] $43 |CI0 RPT.SELECTION: // selection starts after REPORT