You are on page 1of 5

MULTIPLE REPORTS

This Is used to generate multiple outputs from the same data source.
Commands for multiple reports:
- DECLARE-LAYOUT
- DECLARE- REPORT
- FOR-REPORT
- USE-REPORT

DECLARE-LAYOUT

 This is used to define the different output formats generated using the multiple
reports.
 This is used in Begin-Setup section.
 Based on number of outputs generated, that many number of DECLARE-
LAYOUT commands must be written in the Begin-Setup section.
Syntax:
DECLARE-LAYOUT <Layout name>
Other commands
END-DECLARE

Example:

BEGIN-SETUP
DECLARE-LAYOUT EMPDET
#INCLUDE ‘setup02.sqc’
END-DECLARE
DECLARE-LAYOUT PAYSLIP
#INCLUDE ‘setup01.sqc’
END-DECLARE
DECLARE-LAYOUT EMPTAB
END-DECLARE
END-SETUP

DECLARE-REPORT:

 This is used to assign the layout of the report.


 This is used in Begin-Setup section.
 Based on number of outputs generated, that many number of DECLARE-
REPORT commands must be written in the Begin-Setup section.
Syntax:
DECLARE-REPORT <Layout name>
LAYOUT= <layout name>
END-DECLARE

Example:

BEGIN-SETUP
DECLARE-REPORT EMPDET
LAYOUT= ‘EMPLDET’
END-DECLARE
DECLARE-REPORT PAYSLIP
LAYOUT= ‘PAYSLIP’
END-DECLARE
DECLARE-REPORT EMPTAB
LAYOUT= ‘EMPTAB’
END-DECLARE
END-SETUP

FOR-REPORT:
 This is used to assign different heading and footing sections to different
reports.
 This is used in heading and footing sections.
Syntax:
BEGIN-HEADING/ FOOTING # FOR-REPORT <report name>
PRINT commands
END-HEADING/ FOOTING

Example:

BEGIN-HEADING 2 FOR REPORT = ‘EMPLDET’


PRINT ‘employee detail report’ (1, 20) BOLD BOX
PRINT ‘EID’ (2, 1) BOLD UNDERLINE
PRINT ‘NAME’ (2, 10) BOLD UNDERLINE
PRINT ‘SALARY’ (2, 40) BOLD UNDERLINE
PRINT ‘DOJ’ (2, 55) BOLD UNDERLINE
PRINT ‘COUNTRY’ (2, 70) BOLD UNDERLINE
END-HEADING
BEGIN-HEADING 2 FOR REPORT =’PAYSLIP’
PRINT ‘PAYSLIP’ (1, 15) BOLD BOX
END-HEADING
BEGIN-HEADING 2 FOR REPORT=’EMPTAB’
PRINT ‘EMPLID’ (1, 1) BOLD UNDERLINE
PRINT ‘NAME’ (1, 10) BOLD UNDERLINE
PRINT ‘AGE’ (1, 45) BOLD UNDERLINE
END-HEADING
BEGIN-FOOTING 1 FOR REPORT=’EMPLDET’
PRINT ‘** confidential information**’ (1, 10) BOLD
END-FOOTING
BEGIN-FOOTING 1 FOR REPORT=’PAYSLIP’
PRINT ‘Sign not required’ (1, 10) BOLD
END-FOOTING

USE-REPORT

 This is used to assign different programs or procedure sections coding to the


different reports.
 This is used in program or procedure sections.
Syntax:
USE-REPORT <report name>
Commands
USE-REPORT <report name>
Commands

Example:
BEGIN-PROCEDURE PRINTING
USE-REPORT=’EMPLDET’
PRINT &EMPLID (+1, 1)
PRINT &NAME ( , 10)
PRINT &MONTHLY_RT ( , 40)
PRINT &HIRE_DT ( , 55)
PRINT &COUNTRY ( , 70)
USE-REPORT=’PAYSLIP ‘
PRINT ‘EMPLID : (1, 1)
PRINT ‘NAME : (3, 1)
PRINT ‘MNTHLY_RT : (5, 1)
PRINT &EMPLID (1 , 40)
PRINT &NAME ( 3, 40)
PRINT &MNTHLY_RT (5, 40)
NEW-PAGE
USE-REPORT=’EMPTAB’
PRINT &EMPLID (+1, 1)
PRINT &NAME ( ,10)
PRINT &AGE ( ,50)
END-PROCEDURE

You might also like