Please enable JavaScript to view this site.

A-Shell Reference

UPDATE’RECORD #channel, varlist

This statement rewrites a previously locked record and updates all indexes accordingly.

The recnovar variable (from the OPEN statement) determines which record will be updated. Normally it is set automatically by a GET operation with the LOCKED option. However, it could also be set manually, or via an ISAM'POP statement.

Because failed GET and NEXT operations do not update the recnovar variable, you should always check the value of the status variable after these operations to avoid inadvertently updating the wrong record.

If the record specified by the recnovar value is not currently locked, the attempted UPDATE'RECORD will generate ASB error 42 (record not locked).

UPDATE'RECORD does not release the lock on the record. So normally you would follow it with a RELEASE'RECORD operation.

The UPDATE'RECORD operation performs all necessary index operations so that the indexes match the updated data.

Except as noted below, all errors are trapped as ASB errors.

Comments

The most likely error during UPDATE'RECORD would be an attempt to add a record with a duplicate key, assuming duplicates not allowed. Normally this will trigger ASB error 208, but you can stifle the ASB error and instead get back the status value 2 (in the fstatvar parameter specified in the OPEN statement) by setting the AF_ISAMNODUPERRS flag in Xcall ASFLAG.