Purpose
Accesses records logically, based on set relationships, or physically, based on database location.
Records can be accessed serially in a specified set or area, or accessed by selected specific occurrences of a given record type within the set or area.
Syntax
►►───┬─ FIND ───┬───┬──────────────────────────┬──────────────────────────────► └─ OBTAIN ─┘ └─ KEEP ───┬─────────────┬─┘ └─ EXCLUSIVE ─┘ ►───┬─ NEXT ────────────┬──┬───────────────┬── WITHIN ─┬─ set-name ──┬───────► ├─ PRIOR ───────────┤ └─ record-name ─┘ └─ area-name ─┘ ├─ FIRST ───────────┤ ├─ LAST ────────────┤ └─ sequence-number ─┘ ►───┬────────────────────┬── . ──────────────────────────────────────────────►◄ └─ error-expression ─┘
Parameters
Places a shared lock on the object record.
Places an exclusive lock on the object record.
Specifies the next record in the specified set or area relative to the current record.
Specifies the prior record in the specified set or area relative to the current record.
Specifies the first record in the set or area.
Specifies the last record in the set or area.
Either the name of a variable data field that contains the sequence number of a record in a set or area or the sequence number itself expressed as a positive or negative integer. The actual sequence number, expressed as a positive or negative integer.
If sequence-number is negative, the specified set must have prior pointers.
Specifies only occurrences of the named record type.
Record-name must be defined as a member of the object set or be contained in the object area.
Record-name must be specified if set-name or area-name is specified, unless the record or one of the record's elements is named explicitly somewhere in the dialog's process code, or if the record is associated with the dialog as a map record.
Introduces the named set or area to be searched.
Specifies the set to be searched.
Specifies the area to be searched.
The named set or area must be known to the dialog's subschema.
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 FIND/OBTAIN WITHIN SET/AREA command:
|
Status code |
Meaning |
|---|---|
|
0000 |
The request was executed successfully |
|
0304 |
A sequence number of zero or a variable data field containing a value of zero was specified for the object record |
|
0306 |
Currency was not established for the named record, set, or area |
|
0307 |
The end of the set or area was reached, or the set is empty |
|
0308 |
The object record is not in the dialog's subschema |
|
0310 |
The dialog's subschema specifies an access restriction that prohibits retrieval of the named record |
|
0318 |
The record retrieved was not bound. The record or one of the record's elements must be named explicitly somewhere in the dialog's process code, or the record must be associated with the dialog as a map record |
|
0323 |
The named area is not in the dialog's subschema, or the named record is not in the named area |
|
0326 |
The object record cannot be found |
|
0329 |
A run-unit deadlock condition occurred. DBMS aborted and rolled back the run unit. All resources associated with the task are released |
Further Considerations
The owner record also becomes current of the set named in the FIND/OBTAIN command. Currency of other sets in which the record participates as member or owner is not changed.
Example
The statements in the following example illustrate the use of the FIND/OBTAIN WITHIN SET command to retrieve records in an occurrence of the ORDER-ITEM set:
MOVE 'BB' TO ORD-NUM. FIND CALC ORDOR. OBTAIN FIRST ITEM WITHIN ORDER-ITEM. OBTAIN NEXT WITHIN ORDER-ITEM. OBTAIN 5 WITHIN ORDER-ITEM. OBTAIN NEXT WITHIN ORDER-ITEM.
If the fifth ITEM record is the last record in the ORDER-ITEM set, the fourth OBTAIN statement finds the owner ORDOR record.
|
Copyright © 2014 CA.
All rights reserved.
|
|