DBPUT [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
DBPUT
The DBPUT statement adds new entries to a manual master or detail data
set.
The database must be open in access mode one, three, or four (see Table
4-2 in "DBOPEN Statement" for the meanings of these modes). A covering
lock must be in place if mode one is used.
DBPUT...USING... Data will be packed into an internal buffer
from the list of local variables specified in
the PACKFMT statement before writing into the
data set.
DBPUT...FROM... Data will be transferred from the buffer into
the data set.
DBPUT...USING...FROM... Data will be packed into the buffer specified
in the FROM clause using the PACKFMT list that
will then be transferred into the data set.
Syntax
{USING line_id } {,}
DBPUT dbname$ {FROM[=]str_var } {;} DATASET[=]dataset
{USING line_id FROM[=]str_var}
[, ITEMS[=]item_list] [, 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.
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.
str_var The string variable containing the data item values to
be added to the database. The values must be in the
same order as their data item identifiers in the
items_list parameter. The values must be packed into
str_var from their corresponding HP Business BASIC/XL
variables using HP Business BASIC/XL's PACK statement.
line_id A line number or label for a PACKFMT or IN DATASET
statement. The referenced statement is used to
automatically pack data from program variables.
item_list The name of an ordered set of data item identifiers,
either names or numbers. The value of each data item is
in the corresponding position in the ordered set of
values contained in str_var. Any search or sort items
defined for the entry must be included in item_list.
Fields of unreferenced items are filled with binary
zeros.
If the item_list is a string variable, the list of data
item names must be left justified in the string.
Individual data item names are separated by commas and
the last is followed by a semicolon or blank. Embedded
blanks are not 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.
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 "@;".
Examples
The following examples show the use of the DBPUT statement.
110 DBPUT Db$ FROM S$,DATASET=Ds$,STATUS=S(*)
130 DBPUT Db$ FROM S$,DATASET=Ds$,STATUS=S(*)
150 DBPUT Db$ FROM S$,DATASET Ds$,STATUS S(*),ITEMS I$
170 DBPUT Db$ FROM S$,DATASET Ds$,ITEMS I$,STATUS S(*)
220 DBPUT Db$ USING 400; DATASET Ds$
230 DBPUT Db$ USING Pack1; DATASET Ds$,STATUS=S(*)
400 IN DATASET Ds$ USE A,B, SKIP 10,D$
410 Pack1: PACKFMT A,B, SKIP 10,D$
420 DBPUT D6$ USING 400, FROM=S$,DATASET=Ds$
The following statements:
100 DBPUT Dbase$ USING 200 FROM=D$; DATASET = "parts"
200 PACKFMT A,Price,Company$
are equivalent to:
100 PACK USING 200;D$
100 DBPUT Dbase$ FROM D$;DATASET="parts"
200 PACKFMT A,Price,Company$
MPE/iX 5.0 Documentation