EJECT for current page

Hi,

I was tasked to split existing reports (Report A --> REPORT A /REPORT B)
Reports are doing sums and counts, I need to split counts and sums as well.
NEWPAGE performed AT BREAK OF #OFFICE-FIELD (with AT TOP OF PAGE / WRITE TITLE header statements)
Was able to do split records , sums, and counts as required.

Problem:
if all records go to REPORT B, counts and sums in REPORT A become 0 as expected. How can I avoid displaying the headers in REPORT A(as invoked by AT TOP OF PAGE/ WRITE TITLE) when sums/cnts are zero?

I saw that EJECT statement allows not printing the header statements for NEXT page. Is there a similar utility/statement I can use to not print header for CURRENT page? Or should I just recode and remove AT TOP oF PAGE/WRITE TITLE statements?

This is not pretty; but you may be able to achieve your objective this way.

at end of page
write ‘end of page’
if *page-number = 1
set control ‘qs’
end-if
end-endpage
*
write ‘page 1’
*
newpage
write ‘page 2’
end

If you run the program above, page 1 will not appear. Take away the IF clause and page 1 does appear.

I thought set control ‘q’ would work as well, but it does not.

I am quite busy today, but will get to play with it a bit over the weekend.

Was able to make it work like you said with code below:

RESET #NUM (N2)
AT TOP OF PAGE
DO
WRITE ‘PAGE’ *PAGE-NUMBER
IF #NUM EQ 2
SET CONTROL ‘QS’
DOEND
*
ADD 1 TO #NUM
WRITE #NUM
*
AT END OF PAGE
DO
WRITE ‘END OF PAGE’

  • IF *PAGE-NUMBER EQ 1
  • SET CONTROL ‘QS’
    DOEND

NEWPAGE
ADD 1 TO #NUM

Still having problems when I tried it on the report program itself. Sum 0 and at top of page statement still appears… Will play with this option when I get back… maybe I just have to clear buffer pool or something or I’m missing something…

Happy Weekend!!!
Thanks for this Steve!

I just realized what I did wrong…

Steve,

I’m splitting my report into CMPRT01 and CMPRT02…

Is there anyway I can SET CONTROL ‘QS’ to either of these cmprints? is that possible?

Rather than ask Natural to suppress the next line you print, wouldn’t it be simpler not to print that line? Write the totals line only if the values are non-zero. Natural won’t write the title nor invoke the AT END OF PAGE unless a detail line has been written.

Here’s a working example. Change the ACCEPT statement to test for “9”, and you won’t see a report.

DEFINE DATA LOCAL
1 EMP    VIEW EMPLOYEES
  2 PERSONNEL-ID
  2 NAME
  2 FIRST-NAME
1 #C (I4)
END-DEFINE
LIMIT 10
READ EMP BY PERSONNEL-ID
  AT END OF DATA
    ASSIGN #C = COUNT (PERSONNEL-ID)
    IF  #C <> 0
      THEN
        WRITE / 'count:' #C (AD=L)
    END-IF
  END-ENDDATA
  ACCEPT IF  SUBSTR (NAME, 1, 1) = "B"
  DISPLAY PERSONNEL-ID
          NAME
          FIRST-NAME
END-READ
SKIP 1
WRITE TITLE LEFT 'Title Line'
AT TOP OF PAGE
  WRITE 'the top' /
END-TOPPAGE
END