You are a store-in user who plans to update the data item and then
write it back to the cache structure. Serializing this process ensures
that no other user can use or update the data item while you hold
the lock.
- Obtain an exclusive lock by using the IXLLOCK macro. Holding an
exclusive lock ensures that no other user can use or update the data
item.
- If there is a copy of the data item in your local cache buffer,
use the IXLVECTR macro to determine if the copy is valid. If the
copy is valid, go to step 5.
- If a copy does not exist in your local cache buffer or the copy
is no longer valid, use IXLCACHE REQUEST=READ_DATA to read the data
item from the cache structure. If the data item is in the cache structure,
go to step 5.
If a local cache buffer is not assigned to the named data item, assign
the local cache buffer and use a protocol to assign a vector entry
to the buffer.
- If the data item is not in the cache structure, read it from permanent
storage into the local cache buffer.
- Update the data item in the local cache buffer.
- Use IXLCACHE REQUEST=WRITE_DATA to write the updated data item
to the cache structure. To invalidate copies of the data item for
other users, specify CHANGED=YES on the IXLCACHE request.
- Use the IXLLOCK macro to free the exclusive lock.