Previous Topic: COMMITNext Topic: DISCONNECT


CONNECT

Purpose

Establishes a record occurrence as a member in a set occurrence.

Participation of records in sets is governed by the membership options defined for each set in the subschema, as shown below.

Membership option

Description

Automatic

Membership is established automatically when a record is stored.

Manual

Membership is not established automatically. A record is established as a member of the set by using the CONNECT command.

Mandatory

Records remain members of the set until they are erased.

Optional

Records remain members of the set until they are erased or disconnected. For information on erasing or disconnecting a record, see 'ERASE' and 'DISCONNECT' later in this section.

Syntax

►►─── CONNECT record-name TO set-name ───┬────────────────────┬──── . ────────►◄
                                         └─ error-expression ─┘

Parameters

record-name

Specifies the current occurrence of the named record to be connected with the current occurrence of the set specified by set-name.

Record-name must be known to the dialog's subschema.

TO set-name

Specifies the set to which the current occurrence of the named record is connected.

Set-name must be known to the dialog's subschema and must be defined as optional automatic, optional manual, or mandatory manual.

The record is connected to the current occurrence of the named set in the order specified for the set in the schema.

error-expression

Specifies the status codes that are returned to the dialog.

Usage

Considerations

If autostatus is not in use, a dialog's error-status field indicates the outcome of a CONNECT command:

Status code

Meaning

0000

The request was executed successfully

0705

The CONNECT command violates a duplicates-not-allowed option for a CALC, sorted, or index set

0706

Currency was not established for the object record or set

0708

The object record is not in the dialog's subschema

0709

The object record's area was not readied in an update usage mode

0710

The dialog's subschema specifies an access restriction that prohibits connecting the object record to the named set

0714

The CONNECT command cannot be executed because the object set was defined as mandatory automatic

0716

The CONNECT command cannot be executed because the object record is already a member of the named set

0721

An area other than the area of the object record was readied with an incorrect usage mode

0729

A run-unit deadlock condition occurred. DBMS aborted and rolled back the run unit. All resources associated with the task are released

Further Considerations

Example

The statements in the following example establish currency for the ITEM and PRODUCT record types, and connect the current ITEM record to the set occurrence established by the current PRODUCT record:

MOVE 'BB' TO ORD-NUMBER.
FIND CALC ORDOR.
OBTAIN FIRST WITHIN ORDER-ITEM.
MOVE ITEM-PROD-NUMBER TO PROD-NUMBER.
FIND CALC PRODUCT.
CONNECT ITEM TO PRODUCT-ITEM.

More information:

Error Handling

READY