I need a routine that, given a record, will calculate a unique hash total. Something that works like this: -
CALL 'CHKSUM' USING Recordarea, RecordLength, Checksum.
The returned Checksum would probably be 32 characters representing a 16 byte hex value.
This is needed so that I can pass the checksum to/from a web service client, and then use it to check whether the record to be updated has been changed (e.g. by another user) since it was originally read.
When you're programming an update in a classical CICS program you need to ensure that the record doesn't change from the time you read it to the time that the user responds to the update screen with the new values, yet you don't want to hold a lock for all this time as excessive locking can bring the CICS system to a halt. The standard approach is to save a copy of the original record in COMMAREA, and then when the update is received this saved copy is compared with the recently read (with lock) copy. In the rare situation where it has changed the update is abandoned with a message asking the user to re-apply the changes.
Web services are completely stateless and you can't use COMMAREA in this way. Instead you have to pass any "State variables" in the messages being sent between the mainframe and the client. Since this makes such data potentially visible to the client, you need either an encrypted copy of the record or an encrypted hash of some kind. One wouldn't want to program such a hash calculation in COBOL, but such a routine must already exist within ZOS as it is a key requirement to allow web services to update VSAM (etc) records, so I'd be very grateful if somebody would point me at the documentation showing me how to use it.