HP 3000 Manuals

Translation Rules [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation


HP ALLBASE/BRW Reference Manual

Translation Rules 

This table contains a list of Report/V commands and a description of how
they are translated into HP ALLBASE/BRW specifications.

------------------------------------------------------------------------------------------
|                                                                                        |
|         Commands                         HP ALLBASE/BRW Specifications                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| ACCESS                    If given, the access statement is used to define data access |
|                           for the report.  If no ACCESS statement exists, BRWCONV      |
|                           obtains the access specifications from the Report/V          |
|                           compiler.                                                    |
|                                                                                        |
|                           The table PRINT-TABLE is created.  It has type JOIN and      |
|                           contains all files specified in the ACCESS statement as      |
|                           source tables.  The table is tuned to access the source      |
|                           tables in the same sequence as they appear in the ACCESS     |
|                           statement.                                                   |
|                                                                                        |
|                           KEY, CHAIN, and MATCH options are used to determine table    |
|                           relations and the type of access to the source tables.       |
|                                                                                        |
|                           Elements listed in the LIST option are selected for          |
|                           projection.                                                  |
|                                                                                        |
|                           The MODE option is used to determine the DBOPEN mode.  The   |
|                           default is 5.                                                |
|                                                                                        |
|                           There are a maximum of 14 files or datasets in a report.     |
|                                                                                        |
|                           Two or more datasets cannot have the same name.  For         |
|                           example, you cannot convert a report that uses data from a   |
|                           dataset called CUSTOMERS in database TOYDB, and also from a  |
|                           dataset called CUSTOMERS in database OTHERDB.                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| DEFINE(item)              Only heading texts, edit masks, and calculated items are     |
|                           translated.  Items with a COMPUTE parameter become numeric   |
|                           table calculated items with the formula given in the         |
|                           arithmetic expression.                                       |
|                                                                                        |
|                           You must also define an item's alias name (if any) in the    |
|                           data dictionary.  BRWCONV cannot take the alias name         |
|                           directly from the DEFINE(item) statement.                    |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| DETAIL                    Used as the detail lineset.                                  |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| GROUP(n)                  The item with sort level n is printed with suppressed        |
|                           repetition of equal values.                                  |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| GROUP(n) SUMMARY          Used as the break level n footing.                           |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| GROUP(n) TITLE            Used as the break level n heading.                           |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION NOBANNER           The default page heading is not created.                     |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION NOHEAD             No column headers are created for the items.                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION WIDTH=n            Used as report width if no PWIDTH is specified.              |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION DEPTH=n            Used as page length if no PDEPTH is specified.               |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION PWIDTH=n           Used as report width.                                        |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| OPTION PDEPTH=n           Used as page length.                                         |
|                                                                                        |
------------------------------------------------------------------------------------------

          Table 22-0.  (cont.) 

------------------------------------------------------------------------------------------
|                                                                                        |
|         Commands                         HP ALLBASE/BRW Specifications                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| PAGE FOOTING              Used as page footing lineset.                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| PAGE HEADING              Used as page heading lineset.                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| REPORT SUMMARY            Used as report footing.                                      |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| REPORT TITLE              Used as report heading.                                      |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| SELECT                    A selection set SET, which contains the selections from all  |
|                           select statements, is created.  If an element is named       |
|                           without selection criteria, a Comparison Predicate parameter |
|                           with the same name as the item is created.  The selection    |
|                           term                                                         |
|                                                                                        |
|                                item SATISFIES ?item                                    |
|                                                                                        |
|                           is added to the Selection Condition and connected to any     |
|                           other selection terms via AND or OR as specified.  The       |
|                           parameter is added to the Selection Set.                     |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| SORT(n)                   The report is sorted by the item specified in the SORT       |
|                           statement.  If multiple SORT statements exist, the priority  |
|                           of the sort items is determined by n.  If a report contains  |
|                           more than 9 sort levels, only those with the 9 highest       |
|                           priorities are translated.                                   |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| !INCLUDE                  The file to be included is expanded into the file where it   |
|                           is referenced.                                               |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| $DATELINE                 DATE and TIME are used.                                      |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| $PAGE                     PAGE is used.                                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| $TIME                     TIME is used.                                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| $TODAY                    DATE is used.                                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| AVERAGE(item-name         The item is printed with the ColCalc AVG[break-num].         |
| [,break-num])                                                                          |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| ALIGN                     The item is positioned in the same column as in the detail   |
|                           lineset.                                                     |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| CENTER                    The print field of the item is centered on the line.         |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| COL=number                The print field of the item starts at position number.       |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| EDIT=edit-mask            Item edits that correspond to edit-mask are created for the  |
|                           item.                                                        |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| HEAD=char-string          Char-string is used as the column header (unless OPTION      |
|                           NOHEAD is specified).                                        |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| JOIN=number               JOIN=number is treated as SPACE=number.  SPACE=number is     |
|                           described later in this table.                               |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| LEFT                      Justify left.                                                |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| LINE=number               The item is placed on a new line.  If number is greater than |
|                           one, n-1 blank lines are inserted first.  If number is zero, |
|                           LINE is ignored.                                             |
|                                                                                        |
------------------------------------------------------------------------------------------

          Table 22-0.  (cont.) 

------------------------------------------------------------------------------------------
|                                                                                        |
|         Commands                         HP ALLBASE/BRW Specifications                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| LNG=number                LNG is ignored if the item has an edit-mask defined either   |
|                           using a lineset, or in DEFINE(item).  If no such edit-mask   |
|                           is defined, the print field of the item has length number.   |
|                           If edit-masks are defined in both DEFINE(item) and lineset,  |
|                           the lineset edit-mask is used.                               |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| NOHEAD                    Suppresses a header for the item.                            |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| NOSIGN                    A layout calculated item is created.  It is named NOSIGN-n   |
|                           where n is a number that makes the name unique.  The formula |
|                           is:                                                          |
|                                                                                        |
|                                IF item < 0 THEN NO_VALUE ELSE item                     |
|                                                                                        |
|                           The item edits for this item must specify a dash as the      |
|                           NO_VALUE character.                                          |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| PAGE=number               If used with the first item or text in the lineset, it       |
|                           translates to Page Before the lineset.  If used with blank   |
|                           text at the end of a lineset, it translates to Page After.   |
|                           If PAGE is used in the middle of a lineset, it is ignored.   |
|                           Number is ignored.                                           |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| RIGHT                     Right justify.                                               |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| ROW=number                Only translated if it is used with the first item or text in |
|                           a lineset.  Defines absolute positioning of the lineset on   |
|                           line number.                                                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| SPACE[=number]            The item is positioned number spaces after the previous item |
|                           on the line.                                                 |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| TRUNCATE                  The length of the print field is truncated if the item does  |
|                           not fit on the line.  The default is to position the item on |
|                           a new line.                                                  |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| ZERO or ZEROES            Prefill with character "0" is used.                          |
|                                                                                        |
------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------
|                                                                                         |
| MAXIMUM(item-name              The item is printed with the ColCalc MAX[break-num].     |
| [,break-num])                                                                           |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| MINIMUM(item-name              The item is printed with the ColCalc MIN[break-num].     |
| [,break-num])                                                                           |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| TOTAL(item-name [,break-num])  The item is printed with the ColCalc TOTAL[break-num].   |
|                                                                                         |
-------------------------------------------------------------------------------------------
|                                                                                         |
| COUNT(item-name [,break-num])  If the item is numeric, it is printed with ColCalc       |
|                                COUNT[break-num].  Otherwise a calculated item with type |
|                                Integer is created and used with COUNT instead of the    |
|                                original item.  The formula for the calculated item is:  |
|                                                                                         |
|                                                                                         |
|                                     IF original-item = NO_VALUE THEN NO_VALUE ELSE 1    |
|                                                                                         |
|                                The name of the calculated item is COUNT-n where n is a  |
|                                number that makes the name unique.                       |
|                                                                                         |
-------------------------------------------------------------------------------------------

Example Report Conversion 

This section contains a step-by-step example of how to convert a Report/V
report into an HP ALLBASE/BRW report.  The source for the Report/V report
is:
_______________________________________________________________________
|                                                                     |
|                                                                     |
|     REPORT PRODFR;                                                  |
|     DISPLAY "TEST REPORT FROM TOYDB";                               |
|     OPTION NOHEAD,NOBANNER;                                         |
|                                                                     |
|     ACCESS ORDER-DETAILS (TOYDB.PUB),                               |
|                LIST= (PRODUCT-NO, QUANTITY, SHIPMENT-DATE);         |
|            PRODUCTS (TOYDB.PUB), KEY=PRODUCT-NO,                    |
|                LIST=(PRODUCT-NAME, PRICE, PRODUCT-LINE);            |
|                                                                     |
|     DEFINE(ITEM) $TIME,        EDIT="24HH:MM":                      |
|                  $TODAY;                                            |
|                  PRODUCT-NO,   EDIT="^^-^^^-^":                     |
|                  SALES-VALUE P(12,2), COMPUTE= (PRICE) * (QUANTITY):|
|                  SHIPMENT-DATE, ENTRY-"Date Range";                 |
|                                                                     |
|     sort(1) product-line: product-no;                               |
|                                                                     |
|     PAGE HEADING                                                    |
|        "Report: PRODFC", LINE=2:                                    |
|        "Date:",COL=105:                                             |
|        $TODAY, COL=111:                                             |
|        "Time:", COL=121:                                            |
|        $TIME,   COL=127:                                            |
|        "Page:", COL=121, LINE:                                      |
|        $PAGE,   COL=129,LGN=3:                                      |
|                                                                     |
|        "Production Forecast Report", CENTER, LINE=2:                |
|        "__________________________", CENTER, LINE;                  |
|                                                                     |
|     GROUP(1) TITLE                                                  |
|        "Product Line:",  COL=2,LINE=2:                              |
|        PRODUCT-LINE,     COL=16:                                    |
|        "_____________",  COL=2,LINE:                                |
|        "Product Number", COL=16, LINE=2:                            |
|        "Product Name",   COL=34:                                    |
|        "Quantity",       COL=65:                                    |
|        "Unit Price",     COL=79:                                    |
|        "Sales Value",    C0L=96:                                    |
|        "--------------", C0L=16, LINE:                              |
|        "-------------",  COL=34:                                    |
|        "----------",     COL=65:                                    |
|        "-----------",    COL=79:                                    |
|        "------------",   COL=96;                                    |
|                                                                     |
|     BLOCK                                                           |
|       IF (product-line) = 50 THEN                                   |
|        LET (PRICE) = .95 * (PRICE)                                  |
|        ELSE                                                         |
|         LET (PRICE) = (PRICE);                                      |
|     BLOCKEND                                                        |
|                                                                     |
|     GROUP(2) SUMMARY                                                |
|        PRODUCT-NO,       COL=16:                                    |
|        PRODUCT-NAME,     COL=36:                                    |
|        TOTAL(QUANTITY),  COL=65:                                    |
|        PRICE,            COL=79, EDIT= "*******, ^^":               |
|        TOTAL(SALES-VALUE), C0L=94, EDIT= "Z,ZZZ,ZZ^,^^";            |
|                                                                     |
|     GROUP(1) SUMMARY                                                |
|        "--------",       C0L=65:                                    |
|        "-------------",  C0L=95:                                    |
|        TOTAL(QUANTITY),  C0L=65,LINE:                               |
|        TOTAL(SALES-VALUE), C0L=95, EDIT = "$,$$$,$$^,$$":           |
|        " ", PAGE;                                                   |
|                                                                     |
|     SELECT SHIPMENT-DATE AND PRODUCT-LINE;                          |
|                                                                     |
|                                                                     |
_______________________________________________________________________

            

The printed report is shown below:
___________________________________________________________________________________________________________________________________________
|                                                                                                                                         |
|                                                                                                                                         |
|     Report: PRODFC                                                                                          Date: 03/20/92  Time:  08:23|
|                                                                                                                              Page:     1|
|                                                                                                                                         |
|                                                   Production Forecast Report                                                            |
|                                                   __________________________                                                            |
|                                                                                                                                         |
|     Product Line: 50                                                                                                                    |
|     ------------                                                                                                                        |
|                   Product Number    Product Name                   Quantity      Unit Price       Sales Value                           |
|                   --------------    ------------                   --------      ----------       ------------                          |
|                   61-288-F          FILE, FINE                         784       *****11.02         8,639.68                            |
|                   61-288-M          FILE, MIDDLE                       356       *****11.59         4,126,04                            |
|                   61-288-R          FILE, ROUGH                        480       *****12.64         6,067.20                            |
|                   68-401-F          EMERY PAPER FINE                   414       *****23.56         9,653.84                            |
|                   61-288-M          EMERY PAPER MTD.                   545       *****23.56        12,840.20                            |
|                   61-288-M          EMERY PAPER RGH                    895       *****23.28        20,835.60                            |
|                                                                    --------                       ------------                          |
|                                                                       3474                        $62,262.56                            |
___________________________________________________________________________________________________________________________________________

               

Define Data 

The first step in report conversion is to make sure that all elements and
files have been defined in the dictionary.  You can use the DICTDBM
procedure SHOW FILE or compile the report with the DEFN option as
follows:

       :run REPCOMP.PUB.SYS

       SOURCE FILE>  TOYREP

       LIST FILE>

       CONTROL>  DEFN, DICT

The DICT option means that the compiler will check for dictionary
definitions of elements and files used in the report.  Any elements not
defined in either the report or the dictionary, and any files accessed
which are not defined in the dictionary, will cause compilation errors.

The compile listing is printed to your terminal.

The last section of the listing is the Data Definition section:
_______________________________________________________________
|                                                             |
|                                                             |
|                                                             |
|     DATA ITEM DEFINITIONS:                                  |
|                                                             |
|          $PAGE                              I (   4,  0,  2)|
|          $TIME                              T (  64,  0,  2)|
|          $TODAY                             D (  64,  0,  2)|
|       D  PRICE                              P (   7,  2,  4)|
|       D  PRODUCT-LINE                       X (   2,  0,  2)|
|       D  PRODUCT-NAME                       X (  16,  0, 16)|
|       D  PRODUCT-NO                         X (   6,  0,  6)|
|       D  QUANTITY                           I (   4,  0,  2)|
|          SALES-VALUE                        P (  12,  2,  6)|
|       D  SHIPMENT-DATE                      X (   4,  0,  4)|
|                                                             |
|     CODE FILE STATUS: REPLACED                              |
|                                                             |
|                                                             |
|     0 COMPILATION ERRORS                                    |
|     PROCESSOR TIME=00.00.09                                 |
|       ELAPSED TIME=00:00:30                                 |
|                                                             |
|                                                             |
_______________________________________________________________

            

This listing indicates by the D in the first column that all items except
$PAGE, $TIME, $TODAY, and SALES VALUE are defined in the dictionary.  The
first three items are standard Report/V items that BRWCONV will replace
with the appropriate standard HP ALLBASE/BRW items.  SALES VALUE, as seen
in the DEFINE statement in the report source, is a calculated item.
BRWCONV translates calculated items.

The ACCESS statement caused no compilation errors so the files accessed
are defined in the dictionary.

Since all necessary items and files are in the dictionary, no action is
necessary.

Verify Names 

All of the items used in the report are legal HP ALLBASE/BRW names, so no
action is necessary.

Define Date and Time Items 

Use DICTDBM to modify the long name for SHIPMENT-DATE to !DATE-MD.

Create BRWDIC 

Run BRWDIC3000.PUB.SYS. Answer Y to the prompt asking if Parent/Group
items should be included.

Convert the Report 

After completing the preparation steps, you are ready to convert the
report using the steps given in the section in this appendix called
Running BRWCONV.

BRWCONV issues a message that the report has been converted with
warnings.  The file RWARN contains these warnings:
________________________________________________________
|                                                      |
|                                                      |
|     Report/V or Inform/V to BRW Conversion Program   |
|     File :  TOYREP2                                  |
|                                                      |
|     *** WARNING: REPORT/v DISPLAY statement ignored  |
|                   SHIPMENT-DATE, ENTRY="Date Range"; |
|                                                    ^ |
|     *** WARNING: ENTRY option in DEFINE(ITEM) ignored|
|                                                      |
|     *** WARNING: REPORT/V BLOCK statement ignored    |
|                                                      |
|                                                      |
________________________________________________________

            

The Report/V DISPLAY statement prints a message to the terminal when the
report is run.  It has no effect on the final report, so you can ignore
this warning.

The ENTRY option specifies a prompt that tells the user to enter
parameter values.  HP ALLBASE/BRW displays parameter names on the Request
Report screen instead.  You can also ignore this warning.

The BLOCK-BLOCKEND statement has no equivalent in HP ALLBASE/BRW so
BRWCONV cannot translate it.  To see what effect ignoring the statement
has, you can compile and run the new report.  The printed report looks
like this:
___________________________________________________________________________________________________________________________________________
|                                                                                                                                         |
|                                                                                                                                         |
|     Report: PRODFC                                                                                          Date: 03/20/92  Time:  16:58|
|                                                                                                                              Page:     1|
|                                                                                                                                         |
|                                                   Production Forecast Report                                                            |
|                                                   __________________________                                                            |
|                                         *** WARNING(S) occurred during Report Conversion                                                |
|                                                                                                                                         |
|     Product Line: 50                                                                                                                    |
|     ------------                                                                                                                        |
|                   Product Number    Product Name                   Quantity      Unit Price       Sales Value                           |
|                   --------------    ------------                   --------      ----------       ------------                          |
|                   61-288-F          FILE, FINE                         784       *****11.60         9,094.40                            |
|                   61-288-M          FILE, MIDDLE                       356       *****12.20         4.343.20                            |
|                   61-288-R          FILE, ROUGH                        480       *****13.30         6,384.00                            |
|                   68-401-F          EMERY PAPER FINE                   414       *****24.80        10,267.20                            |
|                   61-288-M          EMERY PAPER MTD.                   545       *****24.80        13,516.00                            |
|                   61-288-M          EMERY PAPER RGH                    895       *****24.50        21,927.50                            |
|                                                                    --------                       ------------                          |
|                                                                       3474                        $65,532.30                            |
___________________________________________________________________________________________________________________________________________

               

Notice the differences between this report and the original Report/V
report.  You must manually modify the HP ALLBASE/BRW report to eliminate
the differences, which were caused by the ignored BLOCK-BLOCKEND
statement.

The Report/V BLOCK-BLOCKEND statement modifies the price of products in
product line 50.  To duplicate this in the new report, modify the HP
ALLBASE/BRW report as follows:

   *   Define a calculated item, ADJ-PRICE, with the formula:

               If PRODUCT-LINE = 50
               then PRICE * .95
               else PRICE

   *   Modify the formula for SALES-VALUE so that it is computed based on
       ADJ-PRICE instead of PRICE.

   *   Print out ADJ-PRICE instead of PRICE in the level two break
       footer.

   *   Delete the warning statement from the Report Header.

The modified HP ALLBASE/BRW report prints exactly the same report as the
original Report/V report.



MPE/iX 5.0 Documentation