>>I am writing a SQR which reports employees by department and causes a page
>>break when deptartment changes. This works fine, but the problem is that
>>each employee has multiple lines and sometimes a page-break is caused when
>>only a few of the employee's lines are printed.
>>
>>i.e.
>>
>>emplid01 xxxx xxxx xxx
>> xxxx xxxx xxx xxx
>> xxxx xxxx xxx xxx
>> xxx xxx xxx xxx
>>
>>emplid02 xxx xxx xxx xxx
>>--- page break ---
>> xxx xxx xxx xxx
>>
>>emplid03 xx xxx xxx xxx
>> xxx xxx xxx xxx
>> xxx xxx xxx xxx
>>
>>etc.
>>
>>
>>Is there a simple way to keep these lines together so that emplid02
>>willstart on a new page? The number of lines of information for each
>>employee may differ.
>>
>>Thanks in advance
>>
>> --_ Scott _--
>>
>>
Have you considered breaking up the procedure so that the department and
employee is selected, then call a procedure to retrieve the count of the of
records for the employee?
select distinct department, empno
DO count_emp_records
let #avail_lines = #current-line - {page_depth}
if #avail_lines < &emp_records
new-page
end-if
It would then be possible to check the number of available lines
e.g. {page_depth} -#current-line to prevent splitting the employee detail.
Once satisfied select and print the employee detail records.
Bob Harvey
Bertnor Consulting Services