4 Database Manipulation

The DBINFO Statement

DBINFO provides database structural information from the root file and does not access information within the data sets.

DBINFO (base name, qualifier, mode, status, buffer)

The parameters are:

base name
The same string variable used when opening the database.
qualifier
A variable that references a data set, data item, or volume either by name or number (see the following tables).
mode
A numeric expression specifying the type of information to be returned.
status
An integer array variable that returns status information after DBINFO is executed. The array must contain at least ten elements in its right-most dimension.
buffer
A string variable long enough for the requested information to be returned. The contents of the buffer varies according to the mode parameter used.
The various types of information requests are divided into four categories--data sets, data items, data paths, (for example, relationships between data sets), and data set volumes. In all cases, the information supplied is dependent on the access mode used and is restricted by the user-class number established when the database was opened. Any data sets or data paths in the database which are inaccessible to that specific user class are considered to be nonexistent by DBINFO.

For each mode, the information is returned to the buffer as a word string. Some of the string information may actually represent numeric data. The UNPACK statement, described in page 179 , provides a means of properly interpreting these values. The following tables describe the results associated with a successful execution of DBINFO (Conditional word equal to 0).

DBINFO Modes Returning Data-Path Information

 
Mode Purpose Qualifier Buffer Contents Comments
101Identifies the data-item number for a given data item.Data item name or number.Word 1Data-item number.Integer.
102Describes a specific data item.Data item name or number.Words
1-8

Word 9
10

11

12
13
Data-itemname.

Data-type. Item-word length.
Sub-item count.
0
Control number.
Left-justified and filled with blanks. (L,S,I,X)
Integer.

Integer.

Integer.
Integer.
103Identifies all data items in database(ignored)Word 1
Word
2... n+1
n
Data-item number
...
n = number of data items listed.
All words are integers
104Identifies all data items in a specific data set. The data items are listed in order of occurrence in the data entry.Data setname or number.Word 1
Word
2 ... n+1
n
Data-item number
...
n = number of data items listed.
All words are integers.

DBINFO Modes Returning Dataset Information

 
Mode Purpose Qualifier Buffer Contents Comments
201Identifies a data-set number for a given data set.Data set name or number.Word 1Data set number.If positive, entriescan be read only. If negative, entries can be read, written or modified.
202Describes a specific data set.Data set name or number.Words 1-8

Word 9

10


11
12
13
14 & 15


16 & 17
Data set name. Set type. Entry word-length.
0
0
0
Number of data entries.Data-set capacity.
Left-justified andfilled with blanks. (M,A,D)

Words 10-17
are four-byte
integers.
-202Describes a
specific data
set.
(Same
as mode
202.)
(Same
as mode
202.)
(Same
as mode
202.)
This is the same as mode 202, however it is processed locally (without contacting the database server) and the entry count is always zero.
203Identifies all accessible datas ets in the data-base. The sets are listed in the order of their occurrence in the schema.(Ignored)Word 12...n+1 n number of accessible datasets in database. Arranged in data-set number order. If positive, the data set can be read only. If negative, the data set can be read, written or modified. All words are integers.
204Identifies all accessible datasets which containa specific data item.Data-item name or number.(Same as mode 203.)(Same as mode 203.)(Same as mode 203.)

DBINFO Modes Returning Data-Item Information

 
Mode Purpose Qualifier Buffer Contents Comments
301Identifies paths defined for a specified data set.Data-setname or number.Word 1
2

3

4
............
3n-1

3n

3n+1
n
Data-set number.
Search itemnumber.
0
............
Data-set number.
Search itemnumber.
0
n = Number of paths. Repeat for each path. If qualifier refers to master, set number is for detail. If qualifier refers to detail, set number is for master. Item numbers identify items in detail set. Path designators presented in order of their appearance in schema. All words are integers.
302Identifies a search item for specifieddata set.Master data-set name or number.
OR Detail data-set name or number
Word 1

2
Word 1

2
Search-itemnumber.
0
Search-itemnumber.
Data-set number.
Search-item number in master set. All words are integers. First search item defined in the detail data set.All words are integers.

DBINFO Modes Returning Index-Item Information

 
Mode Purpose Qualifier Buffer Contents Comments
501Identifies the index-item name or number.index-item name or number.Word 1Index-itemnumber.Integer.
502Describes a specific index item.Index-item name or number.Word 1-8

Word 9

Word 10

Word 11

Word n2*n+9...Word 2*n+10
Index-itemname.
Segment count.
Item number.
Item length.
Left-justified and filled with blanks. Integer.
Integer.
Integer.



All words are integers.
503Identifies all index items in database(ignored)Word 1
Word
2 ... n+1
n
Index-item number
n = number of index items listed. All words are integers
504Identifies all index items in a specificdata set. The items are listed in order of occurrence in the data set.Data-set name or number.Word 1
Word
2 ... n+1
n
Index-item number.
n = number of index items listed. All words are integers.

DBINFO Status Array

A DBINFO error assigns a non-zero conditional word (CW) to the first element of the status array. A list of all CW values and their meanings appears in page 197 . The following table describes the status array contents after a successful DBINFO.

 
Array Element Value Description
10CW.
2Buffer LengthNumber of words transferred to the buffer.
30 
4Unchanged 
50 
6Bits 0 through 11The DBINFO identification number 402.
 Bits 12 through 15The mode value used to open the database.
7Program line number 
80 
9Mode numberThe mode parameter value.
10Any valueReserved.


Eloquence Database Manual - 19 DEC 2002