Previous Topic: MODIFYNext Topic: ON Command


OBTAIN

Purpose

Retrieves logical record occurrences.

Syntax

►►───── OBTAIN ───┬─ FIRST ──┬─── lr-name ────────────────────────────────────►
                  └─ NEXT ◄ ─┘

 ►───┬───────────────────────────────────┬──────┬────────────────────┬── . ───►◄
     └─ WHERE lr-conditional-expression ─┘      └─ error-expression ─┘

Parameters

FIRST

Retrieves the first occurrence of the named logical record that meets the selection criteria specified in the WHERE clause.

NEXT

Retrieves the next occurrence of the named logical record that meets the selection criteria specified in the WHERE clause.

NEXT is the default when neither FIRST or NEXT is specified.

If the same selection criteria were not specified in a previous OBTAIN command, OBTAIN NEXT is equivalent to OBTAIN FIRST.

lr-name

Specifies the name of the logical record

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

WHERE lr-conditional-expression

Specifies the selection criteria to be applied to the logical record request.

Syntax for lr-conditional-expression is described earlier in this section.

error-expression

Specifies the status codes that are returned to the dialog.

Usage

Definition

Data from object logical-record fields is transferred to the buffer established in the dialog's record buffers. The OBTAIN command can be issued iteratively to retrieve a series of record occurrences that meet the criteria specified in a WHERE clause.

Example

The statements in the following example retrieve all occurrences of the logical record CUST-ORDER-LR for customer 1234567890:

OBTAIN FIRST CUST-ORDER-LR
  WHERE CUST-NUMBER EQ '1234567890'.
ON LR-NOT-FOUND THEN INVOKE 'CUSTCHEK'.
ON LR-FOUND
  REPEAT.
    OBTAIN NEXT CUST-ORDER-LR
      WHERE CUST-NUMBER EQ '1234567890'.
    .
    .
    .

  END.
DISPLAY.

More information:

Error Handling