Tuesday, 29 March 2016

On Break in SQR with Example

On Break in SQR

A break is a change in the value of a field.
Uses
1. Avoids printing redundant data.
2. Skip lines when the value of the Column is changed.
3. Print a value only if changed.
4. To add spaces in the report.
5. Perform conditional processing on variables that change.
6. Execute a special procedure before or after the break.
7. Print Subtotals.



Sample Programs – Break Logic?
Assume a table ABC is having following data.



1.      SKIPLINES

BEGIN-SELECT
COMPANY (,1) ON-BREAK SKIPLINES = 1
COUNTRY (,+5)
PAY_END_DT (,+5)
EMPLID (,+5)
NAME (,+5)
SALARY (,+5)
 POSITION (+1)
 FROM ABC
END-SELECT

Company will be printed only once and is not repeated.
Skiplines argument provides a line break between each break.





2.      SKIPLINES & LEVEL
BEGIN-SELECT
COMPANY (,1) ON-BREAK SKIPLINES = 2
COUNTRY (,+5) ON-BREAK LEVEL = 2 SKIPLINES = 1
PAY_END_DT (,+5)
EMPLID (,+5)
NAME (,+5)
SALARY (,+5)
 POSITION (+1)
 FROM ABC
END-SELECT






 

1 comment:

  1. puedo imprimir IBM en una pagina y CSC en la siguiente pagina

    ReplyDelete