FIND/OBTAIN CALC

Accesses a record based on the value of the record's CALC key.
idmscu19
Accesses a record based on the value of the record's CALC key.
Syntax
  ►►──┬─ FIND ───┬───┬──────────────────────────┬───────────────────────────────►     └─ OBTAIN ─┘   └─ KEEP ───┬─────────────┬─┘                               └─ EXCLUSIVE ─┘  ►──┬─┬─ CALC ─┬──┬──── 
record-name
 ────┬────────────────────┬── . ───────────►◄     │ └─ ANY ──┘  │                     └─ 
error-expression
 ─┘     └─ DUPLICATE ─┘  
Parameters
  • KEEP
    Places a shared lock on the object record.
  • EXCLUSIVE
    Places an exclusive lock on the object record.
  • CALC
    Accesses the first or only occurrence of the named record type whose CALC key value matches the value of the CALC data item in the dialog's record buffer.
    ANY can be used in place of CALC.
  • DUPLICATE
    Accesses the next occurrence of the named record type with the same CALC key value as the current record of run unit. Use of the DUPLICATE option requires previous access to an occurrence of the same record type by means of the CALC option.
  • record-name
    Specifies the name of the record being accessed.
    Record-name
    must be known to the dialog's subschema.
  • 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 FIND/OBTAIN CALC command:
Status code
Meaning
0000
The request was executed successfully
0306
Currency was not established for the object record (applies to the DUPLICATE option only)
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 object record
0326
The specified 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
0331
The object record was not defined with a location mode of CALC
0332
The value of the CALC data item in the dialog's record buffer does not equal the value of the CALC data item in the current record of run unit (applies to DUPLICATE option only)
Further Considerations
  • The object record must be stored in the database with a location mode of CALC.
  • Before a FIND/OBTAIN CALC command is issued, the CALC key value of the object record must be placed in the applicable field of the dialog's record buffer.
  • After successful execution of a FIND/OBTAIN CALC command, the accessed record is current of:
    • The run unit
    • Its record type
    • Its area
    • All sets in which it currently participates as member or owner
Example
The statements in the following example initialize the CALC key field in a dialog's ORDOR record buffer and retrieve the specified occurrence of the ORDOR record:
MOVE IN-ORDER-NUMBER TO ORD-NUMBER. OBTAIN CALC ORDOR.