Data Type Compatibility [ HP Transact Reference Manual ] MPE/iX 5.0 Documentation
HP Transact Reference Manual
Data Type Compatibility
It is important to know exactly how Transact allocates storage for data
items used with a database or VPLUS form. Table 3-2 shows the storage
allocated by Transact and the number of characters required for display,
based on the type of data item and its size. It also gives the
corresponding COBOL specification as an aid to understanding the Transact
data types.
When Transact programs use VPLUS, databases, and data dictionaries, the
data type compatibilities must be considered carefully. Data type
compatibilities between Transact and these systems are discussed in the
following sections.
Data Types and VPLUS
Data items are displayed on and entered from VPLUS forms in the external
display format. Transact automatically converts between the display
format and the Transact data type before a value is displayed and after a
value is entered. (See Table 3-2 for the display and storage
requirements.) It is important to remember that VPLUS does not add a
character for the sign to its numeric data types, whereas Transact does.
For example, if you want to display a 5-digit numeric data item in a
VPLUS form defined with a maximum size of 5 characters, you must define
it in Transact as positive only. A VPLUS data item with a size of 5
digits allows a maximum of 5 characters but a Transact data item defined
as I(5) requires 6 display characters.
Table 3-3. Compatibility of VPLUS and Transact Data Types
-----------------------------------------------------------------
| | |
| | |
| VPLUS Field of | Transact/V Compatible Types |
| Length n | |
| | |
| | |
-----------------------------------------------------------------
| | |
| CHAR | All types with display length n. |
| | |
-----------------------------------------------------------------
| | |
| DIG | All positive only types of length n |
| | (no decimal points permitted). |
| | |
-----------------------------------------------------------------
| | |
| NUM(m) and IMP(m), | 9(n,m) |
| where m<n | I(n-1,m)* |
| | J(n-1,m)* |
| | P(n-1,m)* |
| | R(n-1,m)* |
| | Z(n-1,m)* |
| | E(n-1,m)* |
| | X(n-1) |
| | |
-----------------------------------------------------------------
The VPLUS field must be one character larger than the
* Transact field to allow space for a plus or minus sign.
Data Types and Databases
There are several differences between the data types for databases and
those for Transact. The main difference is that databases require all
data items to be defined as whole words on word (16-bit) boundaries. To
maintain consistency, you can define a data item in Transact with an odd
number of bytes, but specify that the data item be stored in whole words.
For example, you can define a data item in Transact as 9(5,0,6) to
specify 5 digits, stored as 6 bytes.
This example illustrates the second difference between databases and
Transact data types. Databases do not have a numeric ASCII string data
type. This difference does not cause problems. Transact automatically
converts any numeric ASCII (data type 9) data items to alphanumerics
(data type X) before use. When data is transferred into a Transact type
9 data item, Transact checks to make sure the data is numeric.
Data Types and Data Dictionaries
You can create a data dictionary in which you define the data items,
databases, forms files, MPE files, and KSAM files to be used in Transact
programs. The use of a data dictionary as a central location for data
definitions and attributes allows you to change existing definitions and
attributes easily and dynamically. The data dictionary does not supply
the data itself, which must come from MPE or KSAM files, databases, forms
files, or the user.
There is an exact correspondence between the data item definitions
available with Transact and either Dictionary/V or System Dictionary.
Thus, when a Transact program uses a data item defined in a data
dictionary, it is as if it were defined in the program's DEFINE(ITEM)
statement. All data item attributes can be resolved from the data
dictionary when Transact compiles the program. If Dictionary/V items are
to be resolved at Transact/V run time, all attributes except for heading
or entry text, edit masks, and sub-items, can be resolved.
Transact allows you to use either Dictionary/V or System Dictionary or
both in one program. If you do not specify, Transact assumes
Dictionary/V, by default. To use System Dictionary, you must include
special compiler commands in your source file. These commands are
described in Chapter 10.
When Transact takes data item definitions from System Dictionary, only
attributes defined at the data item level can be accessed. Any
attributes defined at the relationship levels are inaccessible, since
Transact commands can include only the item name and provide no way for
transmitting context information. Therefore, if an item is to have
different attributes in different contexts, System Dictionary must
contain a separate item name and definition for each different set of
attributes. If the data in System Dictionary is structured so as to
support Hewlett-Packard's information management software (such as BRW),
it is recommended that dual dictionaries (or domains) be maintained--one
to support Information Management applications and the other to support
Transact applications. In the System Dictionary that supports Transact
applications, data items can then be redefined as often as necessary.
When defining data items which are extracted from System Dictionary or
Dictionary/V for use in a Transact application, you should note that
Transact only supports data item names that are up to 16-characters long.
If a data dictionary is being used, the Transact compiler looks for any
undefined data items in the appropriate data dictionary. If it cannot
find the data items in the data dictionary, it issues a warning message.
When the Transact/V processor interprets the p-code, it, too, looks in
the Dictionary/V data dictionary for undefined data items, including
those which could not be resolved from a System Dictionary data
dictionary. These data items can be those not satisfied during
compilation or data items defined to be satisfied at run time by a
DEFINE(ITEM) item-name * statement. If the processor cannot find the
data items in the data dictionary, it issues an error message and
terminates processing.
Transact/iX programs do not look in the Dictionary/V data dictionary at
run time. Any items that are not resolved at compile time for
Transact/iX will generate a run-time error when they are used.
At compile time, all data item attributes can be resolved from their data
dictionary definitions. At run time, the Transact/V processor can only
resolve such basic data item attributes as type, size, decimal length,
and storage length. However, it does not get such secondary attributes
as heading or entry text and edit masks.
Transact can resolve VPLUS forms file and form definitions and data set
and file layout definitions only at compile time.
MPE/iX 5.0 Documentation