Browse Prior Art Database

Matrices and System-Wide Data Comparison

IP.com Disclosure Number: IPCOM000035134D
Original Publication Date: 1989-Jun-01
Included in the Prior Art Database: 2005-Jan-28
Document File: 3 page(s) / 16K

Publishing Venue

IBM

Related People

Arnold, HH: AUTHOR [+3]

Abstract

Disclosed is the method OS/2 Database Manager uses to compare data items whose types may differ. When the items being compared are in categories that cannot legally be compared, an error is returned. In the OS/2* Database Manager Extended Edition, the categories that pertain to the U.S.A. are NUMERIC and STRING. Each contains data types (formats e.g., float). The table below shows the types within each category.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 49% of the total text.

Page 1 of 3

Matrices and System-Wide Data Comparison

Disclosed is the method OS/2 Database Manager uses to compare data items whose types may differ. When the items being compared are in categories that cannot legally be compared, an error is returned. In the OS/2* Database Manager Extended Edition, the categories that pertain to the U.S.A. are NUMERIC and STRING. Each contains data types (formats e.g., float). The table below shows the types within each category. CATEGORY CATEGORY TYPE TYPE NUMBER NAME NUMBER NAME 00 NUMERIC 00 SHORT INTEGER (2 bytes) 01 LONG INTEGER (4 bytes) 02 DECIMAL (16 packed bytes) 03 IEEE DOUBLE PRECISION FLOATING POINT (8 bytes) 01 STRING 00 FIXED-LENGTH STRING 01 VARIABLE-LENGTH STRING 02 C string (null terminated) 03 pascal L-String) 04 LONG VARIABLE-LENGTH STRING 05 DATE yyyymmdd (4 packed bytes) 06 TIME hhmmss (3 packed bytes) 07 STAMP yyyymmddhhmmssnnnnnn (10 packed bytes) Note that type and category numbers are expressed in hexadecimal.

Suppose that data1 and data2 are pointers to z_value structures described below. struct z_declen /* Decimal data type field length */ { unsigned char m; /* precision (length of entire decimal) */ unsigned char n; /* scale ( of digits in decimal */ }; union z_varlen /* Variable length */ { short clen; /* length for all types except decima */ struct z_declen dlen; /* length for decimal data types */ }; struct z_value /* Value description */ { short type; /* Variable data type */ union z_varlen len; /* Variable data length */ unsigned char *data; /* Pointer to variable data value */ short ind; /* Null indicator */ };

The contents of these structures completely define the items to be compared. For example, the type of item 1 is "data1->type" and its length is "data1- >len.clen". And data1->data is a pointer to the actual data. However, if data1- >type is hex 0102 (10=NUMERIC, 02=DECIMAL), then "data1->len.clen" cannot be interpreted as a length. Instead, "data1->len.dlen.m" is its precision and "data1->len.dlen.n" is its scale.

The "z_value" is a vehicle for hauling data of any types, for instance, either character string or packed decimal data. The "type" member signifies which one.

The "len" member of the "z_value" structure is a union. When "typea" field indicates a character string, "len.clen" is its length in bytes. When the "type" field indicates short integer, long integer, decimal, or float, then "len.clen" is decomposed through its union into a precision and a scale. The precision of a decimal is its total number of digits (up to 31). Its scale is its number of fraction digits. Scale cannot exceed precision. It can be zero (no fraction digits).

In OS/2 Extended Edition Database Manager, in making data comparison, the lower byte of the type fields is used (i.e., data1-.type >> 8 and data2->type >> 8) as indices into a matrix whose

1

Page 2 of 3

entries are pointers to functions that can compare the two types specified. If the specified entry is "er", the "incompatible type"...