Previous Topic: FIELDS FORNext Topic: FIND / GET MOST RECENT


FIND / GET Logical Record

FIND/GET logical record retrieves records by using paths (defined by DBAs) through the database. Retrieval of logical records continues until either the number of records specified in the retrieval command is obtained or an error in processing is encountered.

Access mode: The syntax below is invalid when the access switch is set to IDMS.

FIND locates database records but does not retrieve them into the report file. GET locates database records and does retrieve them into the report file.

Syntax:

►►─┬─ FINd ─┬─┬──────────────────────────────┬────────────────────────────────►
   └─ GET ──┘ ├─ FIRst ◄ ─┬────────────────┬─┤
              │           └─ record-count ─┘ │
              ├─ NEXt ─┬────────────────┬────┤
              │        └─ record-count ─┘    │
              └─ ALL ────────────────────────┘

 ►─┬────────────┬─ logical-record-name ─┬────────────────┬─ records ──────────►
   └─ view-id. ─┘                       └─ (field-list) ─┘

 ►─┬──────────────────┬───────────────────────────────────────────────────────►◄
   └─ WHEre criteria ─┘
►►─── REPeat with ─┬────────────────────────────┬─────────────────────────────►
                   ├─ FIRst ─┬────────────────┬─┤
                   │         └─ record-count ─┘ │
                   ├─ NEXt ─┬────────────────┬──┤
                   │        └─ record-count ─┘  │
                   └─ ALL ──────────────────────┘

 ►─┬─────────────────────────────────────────────────────────┬─ records ──────►
   └─┬────────────┬─ logical-record-name ─┬────────────────┬─┘
     └─ view-id. ─┘                       └─ (field-list) ─┘

 ►─┬──────────────────┬───────────────────────────────────────────────────────►◄
   └─ WHEre criteria ─┘

Parameters:

FIRST record-count

Retrieves the first n (where n defaults to 1) occurrences of the named logical record (default).

NEXT record-count

Retrieves the next n (where n defaults to 1) occurrences of the named logical record.

ALL

Retrieves all occurrences of the named logical record.

view-id

The qualifying ID for the logical record name. Use view-id when you are signed on to multiple subschemas. View-id refers to the subschema where the logical record can be found.

logical-record-name

Specifies the logical record to be retrieved (required).

(field-list)

Specifies fields within logical-record-name to be displayed in the report. Field-list must be enclosed in parentheses.

When a logical record contains more than one field with the same name, field names entered in the field list can be qualified with the name of a database record. For example, the field name X is used in database records EMP and DEPT. If both of these fields are included in the logical record being retrieved, the user can distinguish them by specifying EMP.X or DEPT.X, respectively.

Note: CA OLQ treats the database records that make up a logical record as group level fields. When you specify a database record name in the field list for a logical record, CA OLQ includes all fields from the named database record that are contained in the logical record.

WHERE

Specifies criteria to be used by CA OLQ when selecting a record occurrence.

REPEAT

Duplicates an immediately preceding FIND/GET LOGICAL RECORD (or REPEAT for FIND/GET LOGICAL RECORD) command, with modifications as specified.

FIRST record-count

Repeats the previous command and specifies the retrieval of the first n record occurrences.

NEXT record-count

Repeats the previous command and specifies the retrieval of the next n record occurrences.

ALL

Repeats the previous command and specifies the retrieval of all occurrences.

WHERE

Specifies the criteria used in selecting records.

Considerations:

Path status is a Logical Record Facility (LRF) concept used to indicate the result of a logical record retrieval request. Path statuses can be system- or user-defined. System-defined path statuses are:

A report file is built whenever the path status is LR-FOUND. Alternatively, a report file will be built for any user-defined path status if OPTIONS=PATHSTATUS is in effect.

Examples:

Get Logical Record

A GET logical record command retrieves the first EMP-JOB-LR logical record:

get first emp-job-lr (emp-name-0415 dept-name-0410 title-0440)

 EMP-JOB-LR
    EMP-NAME-0415        :
     EMP-FIRST-NAME-0415  : 'PHINEAS   '
     EMP-LAST-NAME-0415   : 'FINN           '
    DEPT-NAME-0410   : 'THERMOREGULATION                        '
    TITLE-0440       : 'KEEPER OF BALLOONS  '
 END OF RECORD

Repeat Get

A REPEAT command retrieves the first record that meets the specified selection criteria:

repeat with first emp-job-lr where dept-name-0410 = thermoregulation

 EMP-JOB-LR
    EMP-NAME-0415        :
     EMP-FIRST-NAME-0415  : 'PHINEAS   '
     EMP-LAST-NAME-0415   : 'FINN           '
    DEPT-NAME-0410   : 'THERMOREGULATION
    TITLE-0440       : 'KEEPER OF BALLOONS  '
 END OF RECORD

Logical Record Keyword

A logical record keyword is used in the following example to retrieve the first record for which the TITLE-0440 field value is PROGRAMMER/ANALYST:

get first emp-job-lr where progrmr-analysts

 EMP-JOB-LR
    EMP-NAME-0415        :
     EMP-FIRST-NAME-0415  : 'JAMES     '
     EMP-LAST-NAME-0415   : 'GALWAY         '
    DEPT-NAME-0410   : 'INTERNAL SOFTWARE                       '
    TITLE-0440       : 'PROGRAMMER/ANALYST  '
 END OF RECORD

For more information:

Global Syntax