Software AG Products 2.4.1 | Reference Guide | Execution Commands | Detailed Syntax | @UPDATE
 
@UPDATE
The @UPDATE command updates a record in the database. Before issuing the command, the user must read the desired record and modify fields in the record buffer.
If the application does not update all fields read in the record buffer, it is recommended to use another @ADADCL statement in order to define another record buffer containing only the modified fields. The new values should be assigned to the fields in the new record buffer. This use case requires the use of the ISN clause, where id1 will be ISNnnnn, nnnn being the identification of the appropriate read command.
The syntax if the command is as follows:
syntax of update
In the following example, RECORD-BUF5 is used for reading and contains 20 occurrences of the field SALARY. The user desires to modify only one occurrence of the field SALARY. Therefore, RECORD-BUF6 is declared and contains only one occurrence of the field SALARY with a variable index definition. Updating is performed using this buffer, referring to field SALARY6.
@ADADCL5,EMPLOYEES,SALARY(1-20).
@ADADCL6,EMPLOYEES,SALARY(IND1).
@FIND5.
PERFORM UPD UNTIL E0F5.
.
.
UPD.
.
COMPUTE SALARY6 = SALARY5 (IND1) * 1.05.
@UPDATE6 ISN=ISN5.
@READNEXT5.
If the user is an ET mode user, the record must be read with the HOLD option, otherwise no HOLD is necessary. Adabas Pre-Compiler automatically places the record in HOLD status while Exclusive with DEBUG options are issued.
The PASSWORD parameter is used for protected files. The user must provide an identifier containing a valid password.
The CIPHER parameter is used for ciphered files. The user must provide an identifier containing a valid cipher code.
Note: 
When updating a record that has a field defined as an unique descriptor, response code 198 may occur in the case that the value of the descriptor field updated already exists. In this case, the program should check for response code 198. VMS users should check for response code 98.