FIND CHAIN [ QUERY/V Reference Manual ] MPE/iX 5.0 Documentation
QUERY/V Reference Manual
FIND CHAIN
Locates data entries from a detail data set and one or more of its
corresponding master data sets.
Syntax
{IS}
{IE}
F[IND] CHAIN [#LIMIT=i;] item identifier {EQ} "value"
{= }
[ {IS} ]
[{AND} {IE} ]
[{OR } item identifier {EQ} "value"]... [END]
[ {= } ]
For example:
>F CHAIN EMPLOYEE.BADGE#,LABOR.BADGE# IS "1234" OR&
>> EMPLOYEE.BADGE#,LABOR.BADGE# IS "9018"
Where item identifier = EMPLOYEE.BADGE#,LABOR.BADGE#, and "value" =
"1234" or "9018"
>FIND CHAIN EMPLOYEE.BADGE#,LABOR.BADGE# IE "1234"
Where master set name = EMPLOYEE, master search item = BADGE#, detail set
name = LABOR, detail search item = BADGE#, value = "1234"
Parameters
i is an integer specifying the maximum number of
qualifying entries you want to retrieve. i must
be >= 0. If you specify a negative number, QUERY
ignores your input. When the #LIMIT parameter is
specified, only the first qualified entries are
placed in the select file. If fewer than i
entries exist, all entries that qualify are placed
in the select file.
item identifier takes the form:
master set name. master search item,
detail set name. detail search item
master set name is the name of a master data set
in the data base.
master search item is the name of a data item
defined as the search item for the master data
set.
detail set name is the name of a detail data set
that is associated with the master data set
previously named.
detail search item is the name of a data item
defined as a search item for the detail data set.
This search item must provide the link between the
detail set and the previously defined master set.
value is a data item value. It must be the same
type and within the same value range as the master
search item and detail search item of the data
item. Value must be enclosed in quotation marks
only if it contains special characters or blanks.
Null values may be used. Refer to "Using Null
Values" under the FIND command. Value must be an
exact match for character type data items (type U
or X).
END must be included in a procedure.
Discussion
Only one detail data set can be accessed using a FIND CHAIN command, but
multiple master sets can be used if they relate to the same detail data
set through search items.
The data base administrator can provide you with the information required
to use this command, or you can use the FORM command to determine the
data item and data set relations.
When you enter FIND CHAIN, QUERY searches the specified master data sets
for an entry containing the specified search item value. Then QUERY
searches the specified detail data set for entries containing the same
search item value. Detail entries with the same search item value are
called chains. The effect of FIND CHAIN is to locate all the members of
a detail chain and the master data entry which constitutes the chain
head. For more information on chains, chain heads, and data set
relations, consult the IMAGE Reference Manual.
When using the FIND CHAIN command:
* Only selection on the basis of equality may be made. Relational
operators other than IS, IE, EQ, and = are not allowed.
* Only one value per relational operator is allowed.
* Data items named in the command must always be search items (as
defined in the data base).
* Up to 50 logical connectors (AND, OR) can appear in the same command.
Refer to the FIND command for more information about logical
connectors.
* No more than 16 values can be used in each FIND CHAIN command.
Example
In the example below, CUSTOMER is searched for an entry containing
ACCOUNT equal to 76623455, and one entry is found. Then PRODUCT is
searched for an entry containing a STOCK# equal to 6550D22S, and one
entry is found. Then SALES is searched for entries with both ACCOUNT
equal to 76623455 and STOCK# equal to 6550D22S, but no entries are
located. CUSTOMER is searched for entries containing ACCOUNT equal to
54283545 and SALES is searched for entries containing ACCOUNT equal to
54283545. One entry is found for each relation. Note that both STOCK#
and ACCOUNT are search items.
>FIND CHAIN CUSTOMER.ACCOUNT,SALES.ACCOUNT IS 76623455 AND&
>> PRODUCT.STOCK#,SALES.STOCK# IS 6550D22S OR&
>> CUSTOMER.ACCOUNT,SALES.ACCOUNT IS 54283545
4 ENTRIES QUALIFIED
>R ALL
ACCOUNT =76623455
LAST-NAME =MCFALL
FIRST-NAME =JEFFREY
INITIAL =X
STREET-ADDRESS =6650 MONTEREY ROAD
CITY =CARMEL
STATE =CA
ZIP =93921
CREDIT-RATING =3.20000
STOCK# =6550D22S
DESCRIPTION =BASEBALL BAT
ACCOUNT =54283545
LAST-NAME =MAYFIELD
FIRST-NAME =WILLIAM
INITIAL =
STREET-ADDRESS =39 41ST AVE.
CITY =PETALUMA
STATE =CA
ZIP =10101
CREDIT-RATING =8.50000
ACCOUNT =54283545
STOCK# =4397D13P
QUANTITY =1
PRICE =4590
TAX =276
TOTAL =0
PURCH-DATE =121585
DELIV-DATE =121685
MPE/iX 5.0 Documentation