NOTE: QREP does not parse the newer "full name" data types correctly. This prohibits the totaling of numeric fields as QREP does not recognize them as such. Older Schema Definitions (SD) that use the single letter abbreviations for data types work fine with QREP. Because of the development of ACCENT R, such abbreviations are no longer used and will cause compilation errors.
It is strongly recommended for users to use REPORTER (optional utility) or the DO REPORT command for reporting needs. There are no plans at this time to update QREP as other utilities which have the same function and do a better job are available.
PURPOSE: QREP simplifies reporting. It creates a ready-to-use reporting program by prompting the user for needed information. In some cases, a carriage return will select the default shown within the prompt. This utility lets new users generate reports immediately without coding. It speeds up development time for experienced programmers by creating report programs for immediate use or further customization.
In the QREP dialogue, fields (and their format) are chosen which appear as columns on the report. Report formatting includes options for pagination, headings, subtotaling, grand totaling, column titles, and width specifications. QREP then produces a compiled program from this information.
QREP features include:
Relating several Data Sets (DS) to produce a single report.
Retrieving data through Data Indexes (DI).
Reporting DS's with multiple row types.
Using numerical expressions to generate new data for reporting.
QREP
The master Data Set (DS) used for this report is shown here with its Schema Definition (SD). They are located in the books directory, defined as nisdemo.
*LIST SD SALES_DBM2<CR>
00100 STORE_CODE,C,4
00110 ORD_NUM,C,20
00120 ORD_DATE,F
00130 QTY,I,6
00140 PAY_TERMS,C,12
00150 TITLE_CODE,C,6
*USE DS NISDEMO: SALES_DBM2
*EXTRACT<CR>
7018 Z4805 08/14/91 70 Net 30 CP2264
5422 X6914 09/22/91 75 Net 60 TR7813
6904 V5023 07/16/91 60 Net 30 SF0175
3751 M7132 10/08/91 55 Net 60 FL6492
2343 P9241 09/01/91 40 Net 30 NF5689
8635 Y0357 09/25/91 25 Net 30 SF0175
9576 D3468 10/13/91 45 Invoice NF5689
4267 H1579 09/10/91 20 Net 60 FL6492
0180 K8680 08/27/91 80 Invoice SF0175
6359 A2796 09/09/91 50 Net 30 CP2264
QREP first asks for the Data Base Library (DBL) containing the DS to be reported on. If a DBL has already been declared prior to invoking QREP, this prompt is skipped. The status message "Initializing..." indicates that QREP is generating some temporary work files. Response to prompts are shown in bold print.
*QREP<CR>
QREP - Quick Report Writer
Version Number 5.05
Enter a "?" at any prompt for HELP.
Enter your DATA BASE LIBRARY (DBL) name or QUIT: BOOKS<CR>
Initializing…
QREP then prompts for the "Report Process Name" which is the name for the report program generated from this QREP session.
Enter your REPORT PROCESS NAME or QUIT: SALES<CR>
QREP now prompts for the DS for reporting. It first asks if the DS is to be accessed through a DI. A carriage return automatically defaults to "NO." QREP then prompts for the DS name.
Enter your Data Set information
Do you want to access Master Data Set via an Index (Y or N;<CR>=N): <CR>
Enter MASTER DS NAME: NISDEMO: SALES_DBM2<CR>
If the index prompt is responded to with a "Y", QREP asks for the DI name. The domain name is also prompted for. The default domain may be selected by pressing the Return key without input.
Enter MASTER DI NAME: ORDERS<CR>
Enter domain name (<CR>=STORE_CODE): TITLE_CODE<CR>
If the DS contains only a single row type, this terminates the definition for a master DI. If the DS contains multiple row types, the chosen domain determines which row types will be included for reporting. If the domain does not have an ENTER IF clause, all row types will be selected. If the domain contains an ENTER IF clause which selectively retrieves only certain row types, QREP will generate a message listing the row types that will be included.
Next, QREP asks if another DS is to be related. This allows up to 9 more DS's to be included for reporting. A carriage return will default to "NO."
Do you want to RELATE another Data Set (Y or N;<CR>=N): <CR>
The QREP dialogue turns to questions on the format and the columns in the report. It first asks for a "Page Option," which specifies how the rep5ort page will be formatted. The available options are:
Option "T" or <CR> (for hard-copy terminal) produces reports with 66 lines per page, with 3 lines for both the top and bottom margin.
Option "P" (for line printer) produces reports with 60 lines per page and page control characters.
Option "C" (for CRT) produces a report to be displayed on screen, with 24 report lines per screen. QREP prompts at the bottom of each screen with "Next Screen?," and a carriage return in response will display the next 24 lines on screen.
Enter PAGE OPTION (T, P, or C; <CR>=T): C<CR>
QREP prompts for up to three lines of report headings, to be automatically centered and displayed on top of each report page. Fewe5r than three lines of headings can be entered by typing a carriage return at the heading prompt. QREP then generates a confirmation check to accept or re-enter the heading.
Enter up to 3 lines of REPORT HEADINGS - <CR> when done:
Line 1: NATIONAL PUBLISHERS CORPORATION<CR>
Line 2: Sales by Title<CR>
Line 3: September 1998<CR>
Accept REPORT HEADINGS (Y or N; <CR>=Y): <CR>
In addition to the report heading, QREP prints/displays the date and page number on the first line of each report page. The date is left-justified and the page number is right-justified on the page. Because of the date and page number, the first line of the report heading cannot exceed the page width minus 21 characters. The second and third heading lines can each be up to 70 characters long but should not exceed the page width.
Subheadings, subtotals, and/or grand totals can be displayed in the report. If specifying subheadings or subtotals, QREP will ask for one or more "control fields," separated by commas. In this case, subheadings and subtotals are generated each time a value of a control fields changes. QREP limits reports to 10 levels of subheading and subtotaling. To make a sensible report, the DS should be sorted (or indexed with a domain) on the control field(s).
QREP also allows the creation of a full report or summary report. The full report is the default format where data for each row is displayed on a detail line. A summary report suppresses the printing/displaying of detail lines and only shows the subheadings, the subtotals, and the grand totals that have been specified. Samples of a full and summary report are shown later.
Do you want SUBHEADINGS (Y OR N; <CR>=N): Y<CR>
Do you want SUBTOTALS (Y or N; <CR>=N): Y<CR>
Do you want GRAND TOTALS (Y or N; <CR>=Y): Y<CR>
Do you want SUMMARY REPORT ONLY (Y or N; <CR>=N): <CR>
Enter MASTER CONTROL FIELDS for subtotals/subheadings: TITLE_CODE<CR>
QREP interactively prompts for information for each column in the report. This includes: field name, column title, column size, option to total field (numeric fields only), confirmation check to accept or re-enter the data.
The columns can be from any of the data fields in the master or related DS's, or a mathematical expression using one or more of the numerical fields in the specified DS's (such as PRICE * QTY). An expression can be any algebraic combination of operators and fields up to 50 characters long. Care should be taken to ensure that an expression does not result in division by zero. QREP allows a print picture to be entered for an expression (see below).
To choose a field as a column, enter the field name to the prompt for a column. If the field name entered is duplicated in more than one DS, QREP will list the DS's containing this field and allow the proper DS to be specified.
A listing of the SD for any DS's can be obtained by entering a double question mark (??) to the column prompt.
A print picture can be entered along with a column to specify special output format, such as dollar signs, minus signs, commas separating digits, etc. A table of picture formats appears in the subsection NOTES under "Picture Formats".
To enter a print picture, add an "at" sign (@) followed by the desired print picture. Enclose the format in quotation marks. A column with a specified print picture is shown in the following example. A SALES figure of 22351.45 would be displayed as $22,351.45 with this print picture.
Column 1: SALES @"$$$,$$$.dd"<CR>
The default column title for each field is the title stored in the optional TITLE clause of the SD; or, if there is no TITLE clause for that field, the default is the field name.
Columns involving expressions do not have default column titles, and a carriage return to the title prompt will result in no title for that column.
A different title for the column can be selected by typing any alphanumeric string with embedded blanks allowed. The width of the title, however, is limited to the width of the column.
If the title specified is wider than the column width, the title will be truncated. Truncation can be avoided by specifying a wider field width, or by stacking the title across two or three lines with the use of a slash (/). A title entered as "New/Book/Covers" will appear as:
New New
Book -or- Book
Covers Covers
Column titles for numerical data are right-justified, while character or date data are left-justified.
For each column, QREP prompts for a column width. A simple carriage return in response will result in the default width. The default width is determined by:
The width of a print picture entered with the column. This print picture always supersedes a print picture in the SD, if there is any.
The width of a print picture in the field’s SD, for columns entered without a print picture.
The field width, for fields without any print picture.
The value of 18, for expressions entered without a print picture.
When entering a column width, consider the size of the field, the size of the column title, and the size of totals (if there are any). Any desired column width may be entered to override the default, with the exception that dates may not be less than eight (8) characters.
If entering a width less than the field width, QREP will automatically create a print picture for the field with the desired width. Note that a width that is too small for a character data will cause the data to be truncated, and for numerical data will cause an overflow, indicated by asterisks filling the entire field in the report.
For each numerical column, QREP asks if the column is to be totaled. A "Y" response will generate subtotals and a grand total for this column if they are specified.
Since totals often require a larger field width than the field itself, QREP uses the following rules to format totaled fields.
If a print picture is entered with a column, this print picture will always be used.
QREP automatically creates a print picture (if none specified) which will display the maximum number of digits possible for the specified column width.
A print picture stored in the field’s SD will never be used with totaled fields.
Enter the information for each column in the report. Enter a carriage return to the column prompt to terminate entry of columns. QREP allows up to 40 columns in a report.
QREP also keeps track of the total report width and displays it after a column has been entered. The exact width of the report is known at all times as the report is being created. Watch this number closely to avoid creating a report whose width exceeds the maximum width handled by the terminal or printer. CRT terminals and narrow paper printers can generally display a report of up to 80 characters wide, while some terminals and most wide paper printers can print reports of up to 132 characters. If the selected page width is greater than the width of the printer or video display terminal, the report will run off the page or be wrapped around to successive lines.
Column 1: STORE_CODE<CR>
Enter COLUMN TITLE (<CR>=STORE_CODE): STORE/CODE<CR>
Enter COLUMN SIZE (<CR>=4): 6<CR>
Column: STORE_CODE Column Size: 6 Column title: STORE CODE
Ok (Y or N;<CR>=Y)? <CR>
Calculated report width is now: 6
Column 2: ORDER_DATE<CR>
Enter COLUMN TITLE (<CR>=ORDER_DATE): ORDER/DATE<CR>
Enter COLUMN SIZE (<CR>=8): <CR>
Column: ORDER_DATE Column Size: 8 Column title: ORDER DATE
Ok (Y or N;<CR>=Y)? <CR>
Calculated report width is now: 16
Column 3: QTY<CR>
Enter COLUMN TITLE (<CR>=QTY): ORDER/QTY<CR>
Enter COLUMN SIZE (<CR>=3): 5<CR>
Column: QTY Column Size: 5 Column title: ORDER QTY
Ok (Y or N;<CR>=Y)? <CR>
Calculated report width is now: 23
Column 4<CR>
The last prompt of the QREP dialogue allows a report width to be specified greater than the default width. The default width is calculated as the sum of the column widths, plus two spaces between columns. The width is automatically adjusted for report headings. The report width can range between 22 and 132 characters. The page width will be used by QREP for centering report headings and right justifying the page numbers.
At the end, QREP displays a message stating that a report program is ready. To use this program, type USE CM followed by the report program name that has been specified. When generating the report, a prompt will be given for a file name to store the report. Entering a carriage return outputs the report to the terminal.
Warning - QREP has automatically increased default page width
to accommodate report headings.
Enter PAGE WIDTH (<CR>= 55 characters): <CR>
When you get the ACCENT prompt, you may run the new report by using
CM SALES.
*USE CM SALES<CR>
Enter File Name to output report (<CR>=Terminal): <CR>
(The report is displayed on the terminal screen. See below for full and summary report examples.)
The following is a listing of the CM and PM generated by QREP.
*LIST CM SALES<CR>
00100 ! CM SALES
00110 USE DS ORDERS
00120 USE DI ORDERS
00130 TYPE @CR,"Enter File Name to output report (<CR>=Terminal):&
,NOCR
00140 ACCEPT @COMMAND
00150 SET ' TO '+@COMMAND TO @COMMAND IF @COMMAND NE ''
00160 SET 'REPORT VIA SALES DOMAIN TITLE_CODE'+@COMMAND TO @COMMAND
00170 $@COMMAND
00180 ENABLE WARNING MESSAGES
*LIST PM SALES<CR>
00100 ! PM SALES
00110 CONTROL SECTION
00120 RELATE SF FROM COMMAND AS REPORT 1
00130 RELATE DI ORDERS AS MASTER
00140 DECLARE SECTION
00150 ANSWER,CHAR,3
00160 INITIAL SECTION
00170 22 TO @LINES
00180 HEADINGS SECTION
00190 IF:10 @PAGE NE 1
00200 TYPE @CR,'Next Screen?',NOCR
00210 ACCEPT ANSWER
00220 EXIT PROCESS IF @UC ANSWER BEGINS WITH 'N'
00230 CONTINUE:10
00240 PRINT @FDATE,1S, @CENTER("NATIONAL PUBLISHERS &
CORPORATION", 31) @"" TAB 46,"Page ", @PAGE @""
00250 PRINT @CENTER("Sales by Title Code", 55) @""
00260 PRINT @CENTER("September 1991", 55) @""
00270 PRINT
00280 PRINT "STORE",NOCR
00290 PRINT 2S," ORDER",NOCR
00300 PRINT 2S," ORDER",NOCR
00310 PRINT ""
00320 PRINT "CODE",NOCR
00330 PRINT 2S," DATE",NOCR
00340 PRINT 2S," QTY",NOCR
00350 PRINT ""
00360 PRINT 5"-",2S,8"-",2S,5"-"
00370 SUBHEADINGS SECTION
00380 ON TITLE_CODE
00390 PRINT ""
00400 PRINT 1"*","TITLE CODE: ",TITLE_CODE
00410 DETAIL SECTION
00420 PRINT STORE_CODE,3S,NOCR
00430 PRINT ORDER_DATE,2S,NOCR
00440 PRINT 0S,QTY @"5Z"
00450 TOTALS SECTION
00460 ON TITLE_CODE
00470 PRINT 1"*","Total for TITLE CODE: ",TITLE_CODE
00480 PRINT 7S,NOCR
00490 PRINT 10S,NOCR
00500 PRINT 0S,QTY @"5Z"
00510 FINAL SECTION
00520 PRINT @CR,"Grand Total"
00530 PRINT 7S,NOCR
00540 PRINT 10S,NOCR
00550 PRINT 0S,QTY @"5Z"
The following is the listing of the full report.
Sept. 10, 1991 NATIONAL PUBLISHERS CORPORATION Page 1
Sales by Title
September 1991
STORE ORDER ORDER
CODE DATE QTY
----- -------- -----
*Title Code: CP2264
7018 08/14/91 70
6359 09/09/91 50
*Total for Title Code: CP2264
120
*Title Code: FL6492
3751 10/08/91 55
4267 09/10/91 20
*Total for Title Code: FL6492
75
*Title Code: NF5689
2343 09/01/91 40
9576 10/13/91 45
*Total for Title Code: NF5689
85
*Title Code: SF0175
6904 07/16/91 60
8635 09/25/91 25
0180 08/27/91 80
*Total for Title Code: SF0175
165
*Title Code: TR7813
5422 09/22/91 75
*Total for Title Code: TR7813
75
Grand Total 520
The following is the listing of the summary report.
Sept. 10, 1991 NATIONAL PUBLISHERS CORPORATION Page 1
Sales by Title
September 1991
STORE ORDER ORDER
CODE DATE QTY
----- -------- -----
*Title Code: CP2264
*Total for Title Code: CP2264
120
*Title Code: FL6492
*Total for Title Code: FL6492
75
*Title Code: NF5689
*Total for Title Code: NF5689
85
*Title Code: SF0175
*Total for Title Code: SF0175
165
*Title Code: TR7813
*Total for Title Code: TR7813
75
Grand Total 520
NOTES: QREP provides extensive help for its users. A single (?) or double (??) question mark can be entered at any point to obtain help.
? produces an explanation of the prompt and the valid answers for the prompt.
?? produces the Schema Definition (SD) of the Data Set (DS) used in QREP. If more than one DS is used, QREP allows the choice of which SD to review.
The following two examples illustrate the use of QREP’s help facility. The first example shows the use of a single question mark (?) to obtain help information.
Enter PAGE OPTIONS (T, P or C; <CR>=T): ?<CR>
Valid options are:
<CR> or T - Terminal, ie,
66 lines per page, 3 line top/bottom margin, …page divider
P - Printer, ie,
60 lines per page, 0 top/bottom margin, no page divider
C - CRT, ie,
24 lines per page with pause at end of page
The second example shows a double question mark (??) to list an SD.
Enter REPORT COLUMNS - Type <CR> when done.
Column 1: ??<CR>
Field Name Type Size Dec Print Pic. Occurs
LNAME CH 10 0
FNAME CH 8 0
REGION CH 10 0
CITY CH 13 0
MONTH IN 2 0
TV_SALES FL 9 2 3$,3$,2D
VCR_SALES FL 9 2 3$,3$,2D