 |
» |
|
|
|
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 When the data type of a mapped column is updated, all user-created views based
on IMAGE/SQL utility views containing the
updated mapped column are dropped. Therefore, it is desirable to
update data types before IMAGE/SQL users
access the attached database.
Table 2-6 IMAGE/SQL Data Type Mapping Defaults and Alternatives Source Type | Bits | SQL Type Default | Comments on Default | SQL Type Alternative | Comments on Alternative |
---|
Un | 8*n | char(n) | | | | Xn | 8*n | char(n) | | | | Zn[1] | 8*n | decimal(n,0) | default when n <= 15 | char(n)[2] | default when n > 15 | Pn[1] | 4*n | decimal(n-1,0) | default when n <= 16 | char(n/2)[2] | default when n > 16
| I1, J1 | 16 | smallint | | decimal (5,n) | convert to decimal (5,n) where 0≤n<5 | I2, J2 | 32 | integer | | decimal (10,n) | convert to decimal (10,n) where 0≤n<10
| I3, J3 | 48 | decimal(15,0) | value converted to packed decimal | char(6)[2] | 8 bits binary data stored in each char | I4, J4[1] | 64 | char(20)[2] | value converted from binary to printable ASCII; zero-filled; sign included at run time | decimal(15,0) [3] | value converted to packed decimal
| | | | | char(8)[2] | 8 bits binary data stored in each char | K1[1] | 16 | integer | no loss of magnitude | smallint[3] | MSB taken as sign
| K2[1] | 32 | integer[3] | MSB taken as sign | float | short IEEE converted to long IEEE
| | | | | decimal(15,0) | value converted to packed decimal | K3 | 48 | decimal(15,0) | value converted to packed decimal | char(6)[2] | 8 bits binary data stored in each char | K4[1] | 64 | char(20)[2] | value converted from binary to printable ASCII; zero-filled; no sign at run time | float | long IEEE assumed | | | | | decimal(15,0)[3] | value converted to packed decimal | | | | | char(8)[2] | 8 bits binary data stored in each char | K8 | 128 | char(16) | value converted from binary to printable ASCII; zero-filled; no sign at run time | DATE, TIME, DATETIME, INTERVAL | value stored used to represent DATE, TIME, DATETIME, or INTERVAL | R2[1] | 32 | float | value converted from short HP 3000 real to long IEEE real at run time | char(4)[2] | 8 bits binary data stored in each char; no IEEE conversion | R4[1] | 64 | float | value converted from HP 3000 real to long IEEE real at run time | char(8)[2] | 8 bits binary data stored in each char; no IEEE conversion
| X16 | 108 | char(16) | | DATE, DATETIME, INTERVAL, TIME | | all other data types[1] | char(b)[2] | 8 bits binary data stored in each char
| | |
|