HPlogo IMAGE/SQL Administration Guide: HP 3000 MPE/iX Computer Systems > Chapter 2 Using the IMAGE/SQL Utility

Task 4: Updating IMAGE/SQL Utility Data Type Mapping Information

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

This task describes how to select alternative IMAGE/SQL utility data type mapping.

Getting Ready

To select alternative data type mapping, you may first want to examine the default mapping done by the IMAGE/SQL utility. For example, the following default data type mapping information is stored in the ATCINFO file (DBEnvironmentNameCR) for the mapped table CUSTOMER:

 >>DISPLAY MAP CUSTOMER



 TurboIMAGE/XL DB : SALES.SERED.ATC

 DBEnvironment    : PARTSDBE.SERED.ATC

 Owner Name       : SALES



 MAPPED(SOURCE)   SOURCE           MAPPED         SOURCE     MAPPED

    TABLE         FIELD            COLUMN          TYPE       TYPE    NOTES

 ------------ ---------------- ------------------ ------- ----------- -----





 CUSTOMER (CUSTOMER)

              ACCOUNT          ACCOUNT            J2      INTEGER

              LAST-NAME        LAST_NAME          X16     CHAR(16)

              FIRST-NAME       FIRST_NAME         X10     CHAR(10)

              INITIAL          INITIAL            U2      CHAR(2)

              STREET           STREET             X26     CHAR(26)

              CITY             CITY               X12     CHAR(12)

              STATE            STATE              X2      CHAR(2)

              ZIP              ZIP                X6      CHAR(6)

              CREDIT-RATING    CREDIT_RATING      R2      FLOAT     I



 NOTES:

   I: Imprecise(float)/Incompatible(others) mapping between source and

      mapped data types

 >>

By default, R2, the source data type of CREDIT_RATING, is mapped to a FLOAT. The I in the NOTES section indicates that this mapping may be imprecise because of differences in numeric storage between a 32-bit 3000 real (R2) and a 64-bit IEEE real (FLOAT).

Performing the Task

To change default data type mapping, use the UPDATE TYPE command. For example:

   >>UPDATE TYPE IN CUSTOMER.CREDIT_RATING TO CHAR(4)

   Updated information in table CUSTOMER.

   >>

In this example, CHAR(4) is specified as the data type mapping for CUSTOMER.CREDIT_RATING. The DISPLAY MAP command now reflects this change:

 >>DISPLAY MAP CUSTOMER



 TurboIMAGE/XL DB : SALES.SERED.ATC

 DBEnvironment    : PARTSDBE.SERED.ATC

 Owner Name       : SALES



 MAPPED(SOURCE)   SOURCE             MAPPED       SOURCE     MAPPED

    TABLE         FIELD              COLUMN        TYPE       TYPE    NOTES

 ------------ ---------------- ------------------ ------- ----------- -----





 CUSTOMER (CUSTOMER)

              ACCOUNT          ACCOUNT            J2      INTEGER

              LAST-NAME        LAST_NAME          X16     CHAR(16)

              FIRST-NAME       FIRST_NAME         X10     CHAR(10)

              INITIAL          INITIAL            U2      CHAR(2)

              STREET           STREET             X26     CHAR(26)

              CITY             CITY               X12     CHAR(12)

              STATE            STATE              X2      CHAR(2)

              ZIP              ZIP                X6      CHAR(6)

              CREDIT-RATING    CREDIT_RATING      R2      CHAR(4)   IU



 NOTES:

   I: Imprecise(float)/Incompatible(others) mapping between source and

      mapped data types

   U: Source field has been updated

 >>

The U in the NOTES section indicates that the data type mapping for this source field has been updated. The I indicates that the new mapping is incompatible with the source data type because numerical operations cannot be performed on character data.

Task Reference

Table 2-6 IMAGE/SQL Data Type Mapping Defaults and Alternatives

Source TypeBitsSQL Type DefaultComments on DefaultSQL Type AlternativeComments on Alternative
Un8*nchar(n)   
Xn8*nchar(n)   
Zn[1]8*ndecimal(n,0)default when n <= 15char(n)[2]default when n > 15
Pn[1]4*ndecimal(n-1,0)default when n <= 16char(n/2)[2]default when n > 16
I1, J116smallint decimal (5,n)convert to decimal (5,n) where 0≤n<5
I2, J232integer decimal (10,n)convert to decimal (10,n) where 0≤n<10
I3, J348decimal(15,0)value converted to packed decimalchar(6)[2]8 bits binary data stored in each char
I4, J4[1]64char(20)[2]value converted from binary to printable ASCII; zero-filled; sign included at run timedecimal(15,0) [3]value converted to packed decimal
    char(8)[2]8 bits binary data stored in each char
K1[1]16integerno loss of magnitudesmallint[3]MSB taken as sign
K2[1]32integer[3]MSB taken as signfloatshort IEEE converted to long IEEE
    decimal(15,0)value converted to packed decimal
K348decimal(15,0)value converted to packed decimalchar(6)[2]8 bits binary data stored in each char
K4[1]64char(20)[2]value converted from binary to printable ASCII; zero-filled; no sign at run timefloatlong IEEE assumed
    decimal(15,0)[3]value converted to packed decimal
    char(8)[2]8 bits binary data stored in each char
K8128char(16)value converted from binary to printable ASCII; zero-filled; no sign at run timeDATE, TIME, DATETIME, INTERVALvalue stored used to represent DATE, TIME, DATETIME, or INTERVAL
R2[1]32floatvalue converted from short HP 3000 real to long IEEE real at run timechar(4)[2]8 bits binary data stored in each char; no IEEE conversion
R4[1]64floatvalue converted from HP 3000 real to long IEEE real at run timechar(8)[2]8 bits binary data stored in each char; no IEEE conversion
X16108char(16) DATE, DATETIME, INTERVAL, TIME 
all other data types[1]char(b)[2]8 bits binary data stored in each char   

[1] 100% mapping to an SQL type is not available.

[2] Caution: When this type is mapped to char, the numeric meaning is lost in sorting, expressions, and aggregate functions.

[3] Potential to under/overflow the available range. A run-time error results if the data value is outside the range of the SQL type. In this case, you may want to store the data in an alternative type.

 

Feedback to webmaster