Previous Topic: FIND / GET Logical RecordNext Topic: FIND / GET PHYSICAL SEQUENTIAL


FIND / GET MOST RECENT

FIND/GET MOST RECENT retrieves the current of record type for the specified record name. If currency has not been established, an error occurs and the records cannot be retrieved.

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 ─┬─ most RECEnt ───────────────────────────────────────────────────►
   └─ GET ──┘

 ►─┬────────────┬─ record-name ─┬────────────────┬─ record ───────────────────►◄
   └─ view-id. ─┘               └─ (field-list) ─┘
►►─── REPeat with ────────────────────────────────────────────────────────────►

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

Parameters:

MOST RECENT

Retrieves the most recent occurrence of a particular record type.

view-id

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

record-name

The record type to be retrieved (required). Currency must be established for the named record. If a database record name is the same as a CA OLQ keyword, the name should be enclosed in quotation marks.

(field-list)

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

REPEAT

Duplicates an immediately preceding FIND/GET MOST RECENT (or REPEAT for FIND/GET MOST RECENT) command with modifications.

view-id

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

record-name

Specifies the database record type to retrieve.

Since a FIND/GET MOST RECENT command retrieves only one record, the REPEAT command will duplicate the same data unless the field-list parameter is used.

Examples:

The following examples illustrate the use of the FIND/GET MOST RECENT and associated REPEAT commands.

Get Most Recent

A GET command retrieves the most recent DEPARTMENT record:

get most recent department (dept-name-0410 dept-id-0410)

 DEPARTMENT
    DEPARTMENT-DBKEY :    2/5007103:1
   DEPT-ID-0410     :   5200
   DEPT-NAME-0410   : 'THERMOREGULATION      '
 END OF RECORD

Get with a Field List

A GET command retrieves the most recent EMPLOYEE record and specifies a field list:

get most recent employee (emp-id-0415 emp-city-0415)

 EMPLOYEE
    EMPLOYEE-DBKEY   :    1/5007045:1
   EMP-ID-0415      :    479
    EMP-CITY-0415    : 'EASTON         '
 END OF RECORD

Get Most Recent

A GET command retrieves the most recent OFFICE record:

get most recent office (office-code-0450 office-phone-0450(1))
sp.1
 OFFICE
    OFFICE-DBKEY     :    0/5007135:1
   OFFICE-CODE-0450 : '005'
   OFFICE-PHONE-0450(1)    4578123
 END OF RECORD

For more information:

Global Syntax