MODIFY

Replaces element values of a record occurrence in the database with new element values defined in the dialog's record buffer.
idmscu19
Replaces element values of a record occurrence in the database with new element values defined in the dialog's record buffer.
Syntax
  ►►─── MODIFY 
record-name
 ───────┬────────────────────┬────── . ───────────────►◄                                 └─ 
error-expression
 ─┘  
Parameters
  • record-name
    Specifies the current occurrence of the named record to be modified with the values in the dialog's record buffer.
    The named record 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 MODIFY command:
Status code
Meaning
0000
The request was executed successfully
0805
Modification of the record violates a duplicates-not-allowed specification for a CALC record, sorted set, or index set
0806
Currency was not established for the object set
0809
The object record's area was not readied in an update usage mode
0810
The dialog's subschema specifies an access restriction that prohibits modification of the named record
0813
Run-unit currency was not established or was nullified by an ERASE command
0820
The current record of run unit is not the same type as the named record
0821
An area other than the area of the object record was readied with an incorrect usage mode
0825
No current record of set type was established
0829
A run-unit deadlock condition occurred. DBMS aborted and rolled back the run unit. All resources associated with the task are released
0833
Not all sorted sets in which the object record participates are included in the dialog's subschema
0855
An invalid length was defined for a variable-length record
0883
The length of a record in a native VSAM ESDS was changed or a prime key in a native VSAM KSDS was modified
Further Considerations
  • The following conditions must be satisfied before a MODIFY command is executed:
    • All areas affected either directly or indirectly by the MODIFY command must be readied in an update usage mode.
      More information:
      Usage modes are discussed in READY.
    • The values of all elements defined for the object record in the dialog's subschema must be in the dialog's record buffer. If the MODIFY command is not preceded by an OBTAIN or GET command, the application developer must initialize the applicable values.
    • The object record must be established as current of run unit.
  • After successful execution of a MODIFY command, the modified record is current of:
    • The run unit
    • Its record type
    • Its area
    • All sets in which it participates as member or owner
  • The following special considerations apply to the modification of CALC and sort-control elements:
    • If the modification of a CALC or sort-control element violates a duplicates-not-allowed specification in the dialog's schema, the MODIFY command is not executed and an error condition results.
    • When a CALC-control element is modified successfully, the object record can be accessed by using its new CALC key value. The database key of the object record does not change.
    • If a sort-control element is to be modified, the sorted set in which the object record participates must be included in the dialog's subschema.
    • When a sort-control element is modified successfully, any set occurrence in which the object record currently participates as a member is examined. If necessary, the object record is disconnected and reconnected in the set occurrence to maintain the sorted set order.
  • The following special considerations apply to the modification of records in native VSAM data sets:
    • The length of a record in an ESDS cannot be changed even if the records are variable length.
    • The prime key of a KSDS cannot be modified.
Example
The statements in the following example retrieve an occurrence of the CUSTOMER record by using its CALC key, update the value of the CUST-NAME element in the dialog's record buffer, and then modify the record occurrence in the database:
MOVE IN-CUST-NUMBER TO CUST-NUMBER. OBTAIN CALC CUSTOMER. MOVE NEW-CUST-NAME TO CUST-NAME. MODIFY CUSTOMER.