DBGET [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
DBGET
DBGET reads an entire record or specified data items from a data set.
The DBGET statement can be used in the following ways:
DBGET...USING reads data into an internal buffer that
is used as a source for unpacking into a
list of local variables.
DBGET...INTO reads data into the buffer specified.
DBGET...USING...INTO reads data into the buffer specified by
the INTO clause that is used as a source
for unpacking into a list of local
variables.
Syntax
{INTO str_var }
{USING line_id }
DBGET dbname$ { {,} }
{USING line_id INTO str_var {;} DATASET[=]dataset}
[, MODE[=]read_mode]
[, ITEMS=item_list]
[ {str_expr}]
[, KEY={num_expr}]
[, STATUS[=]status_array(*)]
Parameters
dbname$ A string variable whose value is a TurboIMAGE database
name. dbname must be the variable that was passed to a
successful DBOPEN.
str_var The string variable buffer that the values of the data
items specified in the item_list are moved into. The
values in str_var must be assigned to HP Business
BASIC/XL variables using HP Business BASIC/XL's UNPACK
statement.
line_id A line number or label for a PACKFMT or IN DATASET
statement. The referenced statement is used to unpack
data automatically into program variables.
dataset A string expression with a maximum length of 16
characters. Its value is the name of a data set. The
name must be left-justified and if shorter than 16
characters must be terminated by a semicolon or blank.
This parameter can also be an integer or short integer
corresponding to the desired dataset number.
read_mode Either a numeric expression that evaluates to one of the
following or a string expression that evaluates to one
of the equivalent mnemonics:
Value Mnemonic TurboIMAGE Mode
--------------------------------------------------------------------------------------
1 READ Reread
2 SERIAL Serial forward read
3 SERIALBACK Serial backward read
4 DIRECT Direct read
5 CHAIN Chained forward read
6 CHAINBACK Chained backward read
7 CALCULATED Calculated read
8 PRIMARY Primary calculated read
If this parameter is not specified, the default value is
two, (serial).
item_list The list parameter for the DBGET TurboIMAGE library
procedure. The name of a string or an array of one-word
integers containing an ordered set of data item
identifiers. The value for each element in the ordered
list of data item identifiers is packed into str_var in
the same order that they appear in the list.
If the item_list is a string variable, then the names of
the data items must be left-justified, separated by
commas and terminated with a semicolon or blank. The
embedded blanks are allowed and no name can appear more
than once.
The data item_list can contain special symbols such as
@, which specifies all data items in the data set.
Consult the Special List Parameter Constructs table in
the explanation of the DBPUT library procedure in the
TurboIMAGE/XL Database Management System for additional
special symbols and their usage.
If referencing data items by number, the first word in
the short integer array must be the total number of
elements in the array. This number is followed by that
number of unique data item numbers contained in the
first word of the array.
The item_list specified is returned internally by
TurboIMAGE as the current list. Consult the
TurboIMAGE/XL Database Management System for details
about the benefits of using TurboIMAGE's current list.
If the ITEMS option is not specified, HP Business
BASIC/XL sets the item_list to "@;".
num_expr Used only with DIRECT read mode, mode 4. Its value is
the integer record number of the entry to be read.
str_expr Used only with CALCULATED or PRIMARY read mode, modes 7
and 8, respectively. Its value is a search item value
for the master data set referenced in dataset.
status_array A 10-element short integer array to which TurboIMAGE
returns an error code. If an HP Business BASIC/XL
database statement specifies the STATUS option, an error
does not abort the program. Following execution of the
database statement the program can check status_array
and handle the error. The values returned by TurboIMAGE
to this array are detailed in the description of the
status parameter of the equivalent TurboIMAGE library
procedure.
Examples
The following examples show the use of the DBGET statement.
100 DBGET Db$ INTO S$,DATASET=Ds$,STATUS=S(*)
110 DBGET Db$ INTO S$,DATASET=Ds$,MODE=1,STATUS=S(*)
120 DBGET Db$ INTO S$,DATASET=Ds$,MODE=2,STATUS=S(*)
130 DBGET Db$ INTO S$,DATASET=Ds$,MODE=3,ITEMS=I$,STATUS=S(*)
140 DBGET Db$ INTO S$,DATASET=Ds$,MODE=4,ITEMS=I$,KEY=K$,STATUS=S(*)
150 DBGET Db$ INTO S$,DATASET=Ds$,MODE=7,STATUS=S(*),ITEMS=I$,KEY=N
160 DBGET Db$ INTO S$,DATASET Ds$,MODE 8,KEY N,STATUS S(*)
170 DBGET Db$ INTO S$,DATASET Ds$,STATUS S(*)
180 DBGET Db$ INTO S$,DATASET Ds$,STATUS S(*),ITEMS I$
190 DBGET Db$ INTO S$,DATASET Ds$,ITEMS I$,STATUS S(*)
200 DBGET Db$ INTO S$,DATASET Ds$,ITEMS I$,KEY N,STATUS S(*)
210 DBGET Db$ INTO S$,DATASET Ds$,KEY K$,STATUS S(*)
220 DBGET Db$ USING 400; DATASET Ds$
230 DBGET Db$ USING Pack1; DATASET Ds$,STATUS=S(*)
240 DBGET Db$ USING Pack1 INTO S$,DATASET=Ds$
400 IN DATASET Ds$ USE A,B, SKIP 10,D$
410 Pack1: PACKFMT A,B, SKIP 10,D$
The following statements:
100 DBUPDATE Dbase$ USING 200 INTO D$; DATASET = "parts"
200 PACKFMT A,Price,Company$
are equivalent to:
100 DBGET Dbase$ INTO D$;DATASET="parts"
110 UNPACK USING 200;D$
200 PACKFMT A,Price,Company$
MPE/iX 5.0 Documentation