The current settings of the layout options LEFT_MARGIN and RIGHT_MARGIN determine the margins of a report.
If you want a margin to precede the leftmost printed item in your report, set the left margin to the number of blanks needed. For example, when the default left margin setting (0) is in effect, the first character of the output line is printed in print position 1.
If you want a margin of 8 print positions (a blank report field of 8 single-byte or 4 double-byte characters), enter:
>> SET LAYOUT LEFT_MARGIN 8;
The detail line output begins in print position 9 with 8 blanks preceding each printed or displayed line.
When you are working at a terminal, the default standard output is the terminal. The default right margin is 80 for most terminals. To display the current right margin, enter:
>> SHOW LAYOUT RIGHT_MARGIN; RIGHT_MARGIN 80
If you are designing a report to be printed on a wider page, you can set the right margin as needed. For example, if you want the last print position to be 100, enter:
>> SET LAYOUT RIGHT_MARGIN 100;
A report with a left margin of 8 and a right margin of 80 can have 72 single-byte
characters per displayed or printed line. The first character is in position 9 and the last character is in position 80.
The margins you set stay in effect until you end your MXCI session or you reset the margins.
Output lines (detail lines, titles, footings, or any other output) that extend beyond the right margin are folded to the next line. If you are using the default detail line, you can use the LOGICAL_FOLDING layout option to specify that you want the detail lines
Note. A print position is defined in this guide as the space in the output line occupied by one single- byte character. A double-byte character occupies two print positions. When calculating print positions for an output line, special consideration must be given to cases where the output line can contain both single and double-byte characters. For more information, see Printing Double-Byte Characters on page 4-58.
Customizing a Report Setting Margins
If you are specifying a detail line, insert a SKIP clause before a print item to force the item to be printed on the next line.
Figure 4-1 and Figure 4-2 illustrate the default margin settings for displayed and printed output.
Figure 4-1. Default Margin Settings in a Displayed Report
Displayed Report
Left Margin 0
Print Position 1
Right Margin At Output Device Width
Customizing a Report Setting Margins
The default top and bottom margins are one line each. You can increase the apparent size of these margins with a PAGE TITLE or PAGE FOOTING command. If you have no title, specify PAGE TITLE '' for a top margin of 3 lines or specify PAGE TITLE SKIP desired-margin-size - 3 for more than 3 lines.
For example, to produce a margin size of 4 blank lines preceding the headings (SKIP 4 - 3 = SKIP 1), enter:
S> PAGE TITLE SKIP 1;
( 4 blank lines appear here. ) CUSTNUM CUSTNAME
--- ---
The four blank lines are created as follows:
•
The first blank line is the default top margin.•
The second blank line is the specified skip.•
The third blank line is the default skip for the title line.•
Figure 4-2. Default Margin Settings in a Printer Report Printed Report
Left Margin 0 Print Position 1
Right Margin Output Device Width
Customizing a Report Setting Margins
If you specify text in the title line, specify PAGE TITLE SKIPdesired-margin- size - 1, ' text'. For example, to produce a desired margin size of 4 lines (SKIP 4 - 1 = SKIP 3), enter:
S> PAGE TITLE SKIP 3, 'Summary of Employees'; ( 4 blank lines appear here. )
Summary of Employees CUSTNUM CUSTNAME --- ---
In this case, the four blank lines are created as follows:
•
The first blank line is the default top margin.•
The next three blank lines are the specified skips.•
The blank line following the title is the default skip that always follows the title line. Use the same technique for bottom margins, except SKIP follows the footing text if specified.In the next example, the page footing is positioned above a bottom margin of 3 lines (2 lines specified by SKIP 2 and 1 line, which is the default bottom margin):
S> PAGE FOOTING 'Page ', PAGE_NUMBER AS I2 , SKIP 2; .
.
Page 1
( New page starts here. )
For more information about these commands, see Specifying Titles on page 4-20 and Specifying Footings on page 4-24.
Customizing a Report Paginating
Paginating
The report writer features that control where page breaks occur in a report are:
PAGE_LENGTH Specifies the number of lines from the top to the bottom of a page. For example, to set a page length of 55 lines, enter:
>> SET LAYOUT PAGE_LENGTH 55;
Default page length for a printed report = 60 lines.
Default page length on a terminal is ALL. (The entire report is a single page unless you specify the PAGE clause.)
When designing your report, remember that the default top and bottom margins (1 line each) and the lines of the page footing fit within the page length. The report writer uses the remaining space for detail lines, titles, footings, subtotals, and totals. PAGE clause Specifies a page break in detail lines, titles, and footings.
Use the clause:
PAGE number
number specifies the number on the next page and starts a new page numbering sequence.
If you omit number, the current sequence continues.
For example, to specify a page break after each break footing is printed, enter:
S> BREAK FOOTING JOBCODE ( 'Job Title: ', +> JOBDESC, PAGE);
In this example, one numbering sequence is used from the beginning to the end of the report.
NEED clause Specifies the number of subsequent lines that must fit on the current page in detail lines, titles, and footings.
Use the clause:
NEED number
number specifies the number of lines required.
Customizing a Report Paginating
You can specify the maximum number of pages to be printed in a report by setting the PAGE_COUNT layout option. For example, to set the limit to 100 pages, enter:
>> SET LAYOUT PAGE_COUNT 100;
The default PAGE_COUNT value is ALL. The entire report is printed or displayed. To number the pages in a report, use the PAGE_NUMBER function to retrieve the number of the current page. The first page of the report is numbered 1. The report writer maintains the page count based on the page breaks that occur, including those page breaks generated by a PAGE clause or a NEED clause.
The report in Figure 4-3 illustrates features related to page breaks and page numbering. The horizontal lines indicate where page breaks occur.
Tho select data for the report, enter:
>> SELECT *
+> FROM EMPLOYEE E, DEPT
+> WHERE E.DEPTNUM = DEPT.DEPTNUM +> ORDER BY E.DEPTNUM, JOBCODE DESC ;
These commands define the report:
S> DETAIL JOBCODE, +> EMPNUM,
+> CONCAT (LAST_NAME STRIP, ', ', FIRST_NAME) +> AS A25 NOHEAD,
+> SALARY;
S> BREAK ON E.DEPTNUM, JOBCODE; S> BREAK FOOTING E.DEPTNUM (PAGE) ;
S> PAGE TITLE 'Department: ', DEPTNAME ;
S> PAGE FOOTING 'Location ', LOCATION, TAB 50, +> 'Page - ', PAGE_NUMBER AS I2;
Customizing a Report Paginating
Use the NEED clause is when you want to keep a set of lines together, such as a complete address. In the next example, a page break will not occur in the middle of information about a single supplier:
>> SELECT * FROM SUPPLIER +> ORDER BY SUPPNAME;
S> DETAIL NEED 4, 'Supplier No.', SUPPNUM NOHEAD, SKIP 1, +> SUPPNAME NOHEAD, SKIP 1,
+> STREET NOHEAD, SKIP 1,
+> CONCAT (CITY STRIP, ', ', STATE STRIP, +> SPACE 1, POSTCODE) NOHEAD, +> SKIP 1 ;
S> SET LAYOUT PAGE_LENGTH 14; S> LIST FIRST 4;
Figure 4-4 shows the first 4 rows of output. The column of numbers on the right
Figure 4-3. Pagination Features
JOBCODE EMPNUM SALARY
Department : FINANCE 900 500 100 208 202 210 214 23 CRAMER, SUE CLARK, LARRY BARTON, RICHARD KELLY, JULIA HOWARD, JERRY
Location CHICAGO Page - 1
Department : INVENTORY
JOBCODE EMPNUM SALARY
321 219 233 230 32 WINN, BILL TERRY, DAVID MCDONALD, TED LEWIS, ROCKY RUDOLF, THOMAS 900 250 100 200 19000.00 25000.75 29000.00 50000.00 137000.10 32000.00 27000.12 29000.00 24000.00 138000.40
Location LOS ANGELES Page - 2
Department : . . . . . . . . . VST0403.vsd
Customizing a Report Paginating
Figure 4-4. Result of Using the NEED Clause
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 9 10 Supplier No. 8 ATTRACTIVE CORP 7777 FOUNTAIN WAY CHICAGO, ILLINOIS 60610 Supplier No. 2 DATA TERMINAL INC 2000 BAKER STREET LAS VEGAS, NEVADA 66134
Supplier No. 15 DATADRIVE CORP 100 MAC ARTHUR DALLAS, TEXAS 75244
Supplier No. 3 HIGH DENSITY INC 7600 EMERSON
NEW YORK, NEW YORK 10230 S >
Customizing a Report Spacing Items and Lines