Modifying The QREP Reporting Programs

For programmers, the reporting program generated by QREP actually consists of a Command Module (CM) and a Process Module (PM).  Once QREP is exited, the reporting CM or PM can be LISTed to examine the statements generated by QREP.  The modules can be modified just like any other program in ACCENT R.

If QREP encounters any errors when compiling the PM and CM, it will display a warning message on the terminal.  The PM or CM can be edited, the error corrected, and the PM or CM re-compiled.  QREP can also be re-run with corrected answers to the QREP dialogue to generate a new PM and CM.

Declaring The Master Data Set

This subsection describes the procedure used to specify a master Data Set (DS), including specifying a DS with multiple row types or a DI.  The "master" DS is the first DS entered in a QREP session.

Using A Master Data Set

To use a master DS, a DS that resides in the specified DBL must be selected.  Once a DS is entered, QREP examines its SD to see if it contains multiple row types.  If the DS has only one row type, this terminates the procedure to define the master DS.

If the master DS contains multiple row types, QREP will generate additional prompts to allow the selection of row types to include in the report.

First, it asks if all row types are to be included.  If answered "N," QREP will list the row types, one at a time, and allow each row type to be included or rejected.

The prompt sequence for a master DS with multiple row type is shown in the following example, where INV_A and INV_B are the names of the row types in the master DS.

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: INVOICE<CR>
Multiple RT master declared without an index.
Select all row names (Y or N;<CR>=N) N<CR>
Include INV_A (Y or N;<CR>=N): Y<CR>
Include INV_B (Y or N;<CR>=N): <CR>

Relating Additional Data Sets

This subsection describes the procedure for using multiple Data Sets (DS) in a QREP report.  After a master DS has been specified, QREP asks if another DS is to be related for reporting.  If responding with a "Y", QREP will generate additional prompts to allow an additional DS to be related for reporting.  QREP will repeat this procedure until an "N" is entered to the prompt for adding a DS or until ten DS's have been related for a report.

Relating A Data Set

For each additional DS, QREP automatically assigns it a designator (X1 for the first DS, X2 for the second, and so on).  The master DS has a default designator of M.  These designators are used throughout the QREP dialogue to identify the DS's.

QREP relates an additional DS by matching one or more of its fields with fields in the master DS or previously related DS.

After a new DS is specified, QREP prompts for fields from this DS for matching.  These fields are entered on one line, separated by commas.

QREP then prompts for fields from the master or previously related DS's for matching with the above fields.  If a field name is duplicated in the DS's, it must be identified with the designator or QREP will list the DS's containing this field and allows one of these DS's  to be specified.

Do you want to RELATE another Data Set (Y or N;<CR>=N): Y<CR>
QREP has assigned designator X1 to this Data Set.
Do you want to access Related Data Set via an Index
(Y or N;<CR>=N): <CR>
Enter DATA SET NAME to relate for ID X1: STORES<CR>
Enter MATCHING FIELD NAME(s) for ID X1.
:STORE_CODE<CR>
Enter FIELD NAME(s) separated by commas to find STORE_CODE
(Include :ID if Field Name duplicated in previous Data Sets) 
:STORE_CODE:M<CR>
Do you want to RELATE another Data Set (Y or N;<CR>=N): <CR>

The related DS must be sorted in the order of the match fields if the DS is not declared through a Data Index (DI).

When entering matching fields for a new DS, instead of a field name, enter one of the following:

??         to list the SD of the master DS or any previously related DS.

**         to re-initialize.  Information entered for this DS will be cleared and QREP will

             re-prompt for a new DS.

Relating Through An Index

A related DS can be retrieved through a DI.  For each DS QREP asks if a DI is to be used.  If answered with "Y", QREP will prompt for the DI name and a domain.  The default domain is the first domain.

If a DI is used, QREP will not prompt for matching fields from the DS.  Instead, QREP automatically uses the fields defined in the ON clause of the DOMAIN statement as matching fields.

QREP then prompts for fields from the master or previously related DS's for matching with the fields in the ON clause of the domain.

Do you want to RELATE another Data Set (Y or N;<CR>=N): Y<CR>
Do you want to access this Data Set via Index (Y or N;<CR>=N):
Y<CR>
Enter RELATED DI name: STORES<CR>
Enter DI DOMAIN NAME (<CR>=STORE_CODE): <CR>
Enter matching fieldname for STORE_CODE: STORE_CODE:M<CR>

Relating A Data Set With Multiple Row Types

A DS with multiple row types may be added for the report.  However, a DI must be declared and the domain used must contain an ENTER IF clause for only one row name in the DS.

If relating other row names from the same DS, it can be related again.  Use a different domain that specifies another row name.

The flowchart in Figure 11-1 shows the different paths that can be taken to relate an additional DS.

Entering Columns for Multiple-Row Type Data Sets

When more than one row type is used for reporting, QREP will prompt for column information for each row type, and generate a line format for each row type, called "Report-Line Format."  When the report is generated, rows from a specific row type will be displayed using the line format specified for that row type.  The following example shows how QREP prompts for columns for a Master DS containing multiple-row types.

Enter REPORT COLUMNS for HEADER_REC
Type <CR> when done.
----------Report-Line Format 01----------
Column 1:    INVOICE_NO<CR>
Enter COLUMN TITLE (<CR>=INVOICE_NO):   INV NO<CR>
Enter COLUMN SIZE (<CR>=4):    6<CR>
Column:    INVOICE_NO    Column Size: 6    Column Title: INV NO
Ok (Y or N; <CR>=Y): <CR>
Column 2:    <CR>
Enter REPORT COLUMNS for DETAIL_REC
Type <CR> when done.
----------Report-Line Format 02----------
Column 1:

Picture Formats

Character

Purpose

Sample Format

Sample Output

D

One digit is represented for each D; fills empty positions with leading zeroes.  Cannot print/display negative signs.

DDDDDD

or

6D

000125

Z

One digit is represented for each Z; fills empty positions with blanks.  Negative numbers are preceded by a floating minus sign.  Blank field when number is zero.

ZZZZZZ

or

6Z

125

M

The M is the same as Z, except a dash (-) is printed/displayed at rightmost position if number is zero.

MMMMMM

-

*

One digit is represented for each *; fills empty position with leading asterisks. Cannot print a minus sign.

******

or

6*

***125

+

One digit is represented for each +; produces a floating plus (+) or minus (-) before the number.  Prints/displays +0 if value is zero.

++++++

or

6+

+125

+

A single plus sign fixes a plus (+) sign at its position.

+ZZZZZ

+ 125

-

The minus sign is the same as +.  Positive numbers are preceded by blanks and negative numbers by floating minus (-). Prints 0 if value is zero.

———

or

6-

-538

-

A single minus sign fixes a minus sign at its position.  Positive numbers are preceded by a blank at that position.

-ZZZZZ

- 538

$

One digit is represented for each $, prints a floating dollar sign ($) before the number.  Prints $0 when value is zero.

$$$$$$

or

6$

$125

$

A single dollar sign fixes a dollar sign at its position.

$MM.ZZ

$ 5.75

T

The T causes a value to be truncated to the specified digit.  Default is rounding.

$2MT

$ 5

.

The period specifies where a decimal point is to be positioned.  Only one decimal point per picture format.

DDD.DD

043.29

V

The V specifies that the decimal point in this position is to be deleted.

ZZZVZZ

4329

,

The comma specifies where a comma (,) is to be printed/displayed if digits occur to the left.  More than one comma allowed.

ZZ,ZZZ

7,268

( )

The parentheses encloses a negative number  while positive numbers are enclosed with blanks.  When used, the entire picture format must be enclosed in the parentheses.

(ZZZZ)

( 538)

X

Each X specifies a character.  Truncates output when format is shorter than string, and pads output with trailing blanks when format is longer than string.

XXXXXX

ABCDEF

""

Two quotation marks enclosing nothing ("") specify a free format picture.  Output occupies as many positions as needed with no leading nor trailing blanks.  Useful for name concatenations.

 

 

System Fields Used By QREP

The following system fields are used by QREP to store information which may be useful for communicating with other applications under program control.

System Field

Purpose

@STRING (24)

Contains the specified DBL name.

@STRING(25)

Contains the PM name or "*NONE*" if QREP was aborted.