HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)
4-: 147
THREAD IS
The THREAD IS statement defines the thread list that is used by the
SEARCH/SORT process. A thread list is a list of data sets in a database
being searched. The thread list defines the hierarchy as well as the
relationship between the data sets. In a THREAD IS statement, each data
set is represented by a line label that refers to an IN DATASET statement
of the corresponding data set.
Syntax
[ [PATH
num_expr
] ]
THREAD [IS] [
line_id
[LINK
identifier
] {,1;}] ...
line_id
Parameters
line_id
Line number or line label that identifies the line on
which the IN DATASET statement of the dataset is
defined.
num_expr
A numeric expression that evaluates to an integer that
represents the path to use when accessing a detail data
set that is connected to it's master by multiple paths.
identifier
A variable that holds a link value used when trying to
access data in a detail data set that is not linked to
any other data sets in the current thread list.
Examples
100 Set1 : IN DATASET "parts" USE A, B
200 Set2 : IN DATASET "customer" USE Comp$
300 THREAD IS Set1, Set2
The THREAD IS statement on line 100 indicates that during a SEARCH or
SORT, the data set "parts" is accessed first. The data for "parts" is
retrieved and unpacked into variables A and B. Then the data set
"customer" is read, its data retrieved and unpacked into the variable
Comp$.
In going from one data set to the other while walking the thread list,
you can optionally specify the path to be used in case there is more than
one or the key value to be used in case it is from a detail to a master.
The THREAD IS statement must satisfy the following conditions:
* The thread list can be one to ten data sets long.
* The first data set can be either a master set or a detail set.
However, the thread must not have two consecutive data sets of the
same type. That is, a master set cannot follow a master set and a
detail data set cannot follow a detail data set.
* You can optionally specify which path (PATH) to use when connecting
two sets. If PATH is not specified, path 1 is assumed.
Example :
400 THREAD IS Set1, Set2 PATH 2, Set3, Set4
* In case there are no paths defined in the database between a detail
set and a master set, THREAD allows you to define a temporary link by
specifying a link variable (LINK) in the detail set. The link
variable, if used, must be defined in the HP Business BASIC/XL
program and must appear in the IN DATASET statement of the detail
set. It must also be of the same data type as the key in the master.