E@DBUPDRNG

Name

E@DBUPDRNG

Description

This API updates specified fields of the records that match the key and filter conditions, using specified actions and values. Use this API for updates that do not require the original value of a field to be read into the program. For example, to add $20 to an account, the amount originally in the account need not be known.

A return field indicates whether any rows were updated. Also, an error code is returned. Attempts to update a set of rows that cause an error (such as duplicate rows) will cause the update to fail for all of the rows.

Location

The syntax for this routine is generated when a program is compiled.

Input Values

Field Description
You must specify the index name that will be used to locate the records that will be updated.
Record retrieval variables (also known as D@ and D# fields) Define the beginning and ending values of the last key by moving the appropriate values to the record retrieval fields named D@<KeyFieldName> and D#END#<KeyFieldName>.
E@DBBEGRNG Move a number into E@DBBEGRNG in order to tell the interface which key is the last significant one defining the range. This number is equivalent to the position of the field in the index.
E@UPDATECMD

You must specify the update string that will be used in updating the records.

Note: The same working storage value can be used as the update value for more than one field. This is equivalent to using a MOVE or ADD function with the same value on multiple fields.

Return Values

Field Description
E@UPDATECOUNT The working storage field that returns 1 or 0 depending on whether any records were updated.

Using the API in a Program

  • The E@DBUPDRNG routine can only be called from within a program transaction.

  • The E@DBUPDRNG routine locks the record(s), so there is no need to use a E@DBFINDEQ or similar routine before performing the update.

  • E@DBUPDRNG does not have a subrange equivalent. To restrict the records beyond the range keys, you can use E@DBFLTUPDRNG, as described in E@DBFLTUPDRNG.