HP 3000 Manuals

CREATING YOUR OWN DATA NAMES [ INFORM/V User's Guide ] MPE/iX 5.0 Documentation


INFORM/V User's Guide

Chapter 7  CREATING YOUR OWN DATA NAMES 

  

INFORM/V allows you to create your own user-defined data names.  A
user-defined data name is one that you create when you want to include in
the report a column of data that is derived from one of the data names in
the Group or data set.

The total number of user-defined data names you can add depends on the
present number of data names in the Group or data set.  The limits on the
number of data names allowed are shown in Appendix C. You can add data
names up to those limits.

For each user-defined data name, you must specify an existing data name
and a computational expression.  You may also specify an edit mask - -a
format that tells INFORM/V how to display the resulting values.  The
steps to accomplish both tasks are described below.

User-defined data names cannot be used when specifying selection
criteria.

Defining a Data Name 

An example of how a user-defined data name is created is shown in Figure
7-1.  To create one, respond to the prompt:

       TO INCLUDE IN REPORT>

with a plus sign (+).  INFORM/V next prompts with

     NEW DATA NAME>

to which you respond with the user-defined data name.  The name may be up
to 20 characters long (upper and lower case), including spaces.  The data
type for a user-defined data name is always P (11,0,6).

In the example shown in Figure 7-1, the user-defined data name is PROFIT
MARGIN.
_______________________________________________________________________________
|                                                                             |
|     INFORM/V   HP32246v.uu.ff - (C) Hewlett-Packard Co. 1986                |
|                                                                             |
|     DATA NAMES IN ACCOUNTING INFORMATION                                    |
|                                                                             |
|         1: NAME                     7: DESCRIPTION              13: PRICE   |
|         2: ADDRESS                  8: PURCHASE NUMBER          14: TOTAL   |
|         3: ACCOUNT                  9: PURCHASE DATE            15: SHIPDATE|
|         4: DATE                    10: BACKORDERFLG             16: DELVDATE|
|         5: CREDIT                  11: QUANTITY                             |
|         6: PRODUCT NUMBER          12: UNIT COST                            |
|                                                                             |
|     TYPE NUMBER(S) FOR DATA NAME(S):                                        |
|                                                                             |
|                TO INCLUDE IN REPORT> Ý                                      |
|                                                                             |
|                       NEW DATA NAME> PROFIT MARGIN                          |
|            COMPUTATIONAL EXPRESSION> N14 * .50                              |
|                           EDIT MASK> $$,$$$.^^                              |
|                                                                             |
_______________________________________________________________________________

          Figure 7-1.  Creating a User-Defined Data Name 

Defining the Computational Expression.  Next, INFORM/V prompts you with:

     COMPUTATIONAL EXPRESSION>

to which you respond with an expression that will produce values for the
user-defined data name.  You can specify a simple expression, such as the
addition of two data names, or a more complex expression.  (The operators
that may be used in computational expressions are shown later in this
section.)  You can use numbers for data names (N1 for data name 1, N2 for
data name 2, and so on) and digits for values (digits may include decimal
points).  It is also possible to define data names in terms of other
user-defined data names.

In the example in Figure 7-1, the user-defined data name PROFIT MARGIN is
determined by multiplying data name 14 (TOTAL) by .50.  This
computational expression looks like this:

     N14 * .50

The N identifies the first number in the expression as a data name
number.

Defining the Edit Mask.  Next, INFORM/V allows you to specify an edit 
mask - - a format used to display values - - for each user-defined data
name.  The prompt is

     EDIT MASK>

In Figure 7-1 the edit mask $$,$$$.^^ specifies that the value, when
shown in the report, should be preceded by a dollar sign ($) and that a
decimal point should appear two positions from the right.

If you wish to show digits to the right of the decimal point for a
user-defined data name, you must specify an edit mask.  For example, if
the computed value of a data name is .6 and no edit mask is specified,
the value will be rounded to the nearest integer, in this case, 1.
However, if you specify the following edit mask, ^.^ , the value .6 will
appear as 0.6.  (The edit mask characters and examples of their use are
shown later in this section.)  If you do not want to supply an edit mask,
respond to the prompt by entering RETURN.

After you provide an edit mask (if you want to), INFORM/V redisplays the
prompt:

     NEW DATA NAME>

If you do not want to add another user-defined data name, press RETURN.
INFORM/V redisplays the Data Names Menu, adding any user-defined data
names to the menu.  Then it prompts you as usual.  Figure 7-2 shows the
Data Names Menu after a user-defined data name has been added to it.  The
user-defined data name PROFIT MARGIN appears as the last data name.

If you save the report definition in the catalog (option 6 on the Main
Menu), the user-defined data names are retained as part of that report
definition.  However, they do not become a part of the underlying data
sets or files.  Values for the user-defined data names are calculated
anew each time the report is produced.
________________________________________________________________________________
|                                                                              |
|     INFORM/V   HP32246v.uu.ff - (C) Hewlett-Packard Co. 1986                 |
|                                                                              |
|     DATA NAMES IN ACCOUNTING INFORMATION                                     |
|                                                                              |
|        1: NAME                     7: DESCRIPTION              13: PRICE     |
|        2: ADDRESS                  8: PURCHASE NUMBER          14: TOTAL     |
|        3: ACCOUNT                  9: PURCHASE DATE            15: SHIPDATE  |
|        4: DATE                    10: BACKORDERFLG             16: DELVDATE  |
|        5: CREDIT                  11: QUANTITY                 17: PROFIT MAR|
|        6: PRODUCT NUMBER          12: UNIT COST                              |
|                                                                              |
|     TYPE NUMBER(S) FOR DATA NAME(S):                                         |
|                                                                              |
|               TO INCLUDE IN REPORT> 1,6,11,17                                |
|                         TO SORT BY> 1                                        |
|                    TO SUBDIVIDE BY> 1                                        |
|                   TO SUMMARIZE FOR: NAME> 11,17                              |
|                 FOR REPORT SUMMARY>                                          |
|             FOR SELECTION CRITERIA>                                          |
|                                                                              |
|     REPORT TITLE> PROFIT REPORT                                              |
________________________________________________________________________________

          Figure 7-2.  A Data Names Menu that Includes a User-Defined Data Name 

After you respond to the reporting prompts shown in Figure 7-2, INFORM/V
produces the report shown in Figure 7-3.
______________________________________________________________________
|                                                                    |
|     PROFIT REPORT                                                  |
|                                                                    |
|     NAME                   PRODUCT NUMBER  QUANTITY  PROFIT MARGIN |
|     ---------------------------------------------------------------|
|     Albertson John B       90C                  100        $200.00 |
|                            60D                  130         $19.50 |
|                            50B                   30         $37.50 |
|                            50B                    5          $6.25 |
|     =>                                          265*       $263.25 |
|                                                                    |
|     Baker Bill B           80B                   55         $27.50 |
|     =>                                           55*        $27.50 |
|                                                                    |
|     Lewis Charles          55C                   20           $.75 |
|                            90C                  700       $1400.00 |
|     =>                                          720*      $1400.75 |
|                                                                    |
|     Limburger Frank        60D                   15         $22.50 |
|     =>                                           15*        $22.50 |
|                                                                    |
|     Peterson Paul          70A                   20         $15.00 |
|     =>                                           20*        $15.00 |
|                                                                    |
|     Smith John Q           11A                   40          $2.00 |
|                            11B                  400         $20.00 |
|                            11C                  400         $20.00 |
|     =>                                          840*        $42.00 |
|                                                                    |
|     *****END OF REPORT*****                                        |
|                                                                    |
|                                                                    |
______________________________________________________________________

          Figure 7-3.  A User-Defined Data Name Included in a Report 

Computational Expressions 

A computational expression may be used to calculate the value of a
user-defined data name.  All values for the user-defined data name are
automatically initialized to 0, and computations are carried out before
the data is sorted or displayed in the report.  The arithmetic operators
available and their meanings are:

+                                           add
-                                           subtract
*                                           multiply
/                                           divide; give the quotient
//                                          divide; give the remainder

All arithmetic operations are performed in the following order:

1.                                          Division giving the remainder

2.                                          Division giving the quotient

3.                                          Multiplication

4.                                          Subtraction

5.                                          Addition

You can vary the order of operations by using parentheses to group
expressions.

Edit Masks 

An edit mask is a tool used to modify the way data is presented without
changing the data itself.  Edit masks can be defined for any user-defined
data name.

An edit mask used to express data in dollars and cents is:

     EDIT MASK> $$$,$$$!^^ 

This edit mask specifies that for every value to which this mask applies,
a decimal point should be inserted two positions from the right, a comma
should be placed at the third position to the left of the decimal point,
and the entire value should be preceded by a dollar sign.  This edit mask
works for all values up to $99,999.99.

Edit masks cannot be greater than 30 characters.  The INFORM/V edit mask
characters are shown in Table 7-1.  Examples are shown in Table 7-2.

          Table 7-1.  Edit Masks 

---------------------------------------------------------------------------------------------
|                                             |                                             |
|             Edit Mask Character             |                   Meaning                   |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| ^                                           | Insert the actual data in this position.    |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| Z                                           | Suppress leading zeros.                     |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| $                                           | Leading zeros are suppressed; the           |
|                                             | right-most leading zero is replaced with a  |
|                                             | "$".                                        |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| *                                           | Asterisks are displayed in place of leading |
|                                             | zeros.                                      |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| .                                           | Add a decimal point in the position         |
|                                             | specified in the source data.               |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| !                                           | Add a decimal point at the position         |
|                                             | indicated regardless of where a decimal     |
|                                             | point is in the source data.                |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| -                                           | When used at the end on an edit mask, this  |
|                                             | character denotes a negative value.         |
|                                             |                                             |
---------------------------------------------------------------------------------------------
|                                             |                                             |
| DR or CR                                    | When used as the last characters of the     |
|                                             | edit mask, values are displayed with a      |
|                                             | trailing DR (DEBIT) or CR (CREDIT).         |
|                                             |                                             |
---------------------------------------------------------------------------------------------

          Table 7-2.  Examples of Edit Masks 

----------------------------------------------------------------------------------------------
|            Value             |          Edit Mask           |        Value Display         |
----------------------------------------------------------------------------------------------
|                              |                              |                              |
|       000123.4               |      $$,$$$!^^               |          $12.34              |
|        0001234               |       $$,$$$!^^              |           $12.34             |
|         000123.4             |       $$,$$$.^^              |          $123.40             |
|        0001234               |       $$,$$$.^^              |       $1,234.00              |
|        0001234               |      ***,**$.^^              |      *$1,234.00              |
|        0001234               |      zzzzzzz.^^              |          1234.00             |
|        0001234               |      zzzzzzz!^^              |            12.34             |
|        0001234               |      ^^/^^/^^                |        00/12/34              |
|        0001234               |         ^^^^.^^              |          1234.00             |
|        0001234               |         ^^^^!^^              |          0012.34             |
|      -0001234                |      $,$$$.^^CR              |       $1,234.00CR            |
|        0001234               |      $,$$$.^^CR              |       $1,234.00              |
|      -0001234                |      $,$$$.^^DR              |       $1,234.00DR            |
|        0001234               |      $,$$$.^^DR              |       $1,234.00              |
----------------------------------------------------------------------------------------------



MPE/iX 5.0 Documentation