PURPOSE: The PUT statement updates a record in the same auxiliary data set from which it was retrieved by a prior GET statement
PUT /IN/ designator [HUSH] [IF; UNLESS clause] [CHECK]
designator |
is the designator specified in a prior GET statement. |
[CHECK] |
is used to compare the current version of a record with the original record read. If no changes have been made, @AUX is given a value of "NO". If changes have been made, @AUX is given a value of "YES". In either case, the record is not written to disk. This allows for a query to be made based on the value in @AUX to see if the changes should actually be rewritten. |
GET FROM AUX1 MATCH BY STORE_CODE:D ADDRESS:M TO ADDRESS:AUX1 PUT IN AUX1
NOTES: Any DS that is accessed by a PUT statement must be related with the option UPDATE in the RELATE statement.
PUT cannot be used without a prior GET statement for the same DS. If NOT LOCKED is used with the GET statement, ACCENT R re-reads and locks the record for the PUT process. ACCENT R keeps a copy of the original record read. A comparison is done between the user's original copy and the Data Set (DS) copy from disk to see if other users have made changes since the last time the record was read. If no changes have been made, ACCENT R writes the current user's updated version of the record, then unlocks it. If other users have made changes to the record, the @AUX system field is set to "CHANG". The record is unlocked without writing the current user's changes. The record will have to be reprocessed so that prior changes can be acknowledged before the record can be changed again.
This feature allows flexibility in access and faster processing. It provides what is known as optimistic locking. Record blocks are only locked during the actual update. Optimistic locking can be used in applications where it is unlikely that any two users will try to access the same record at the same time.
Transaction records can be rewritten to the transaction DS with the SETUP TO REWRITE TRANSACTION statement.
SEE ALSO: GET Statement and SETUP Statement, @AUX Values (Appendix A)