| Format |
| | Add [expr] to DATABASE [field = expr_n, ...] [/Qualifiers ...] |
| | expr | Primary key of new record in indexed datafile. Do not specify if the datafile is not indexed. |
| | field | Optional field(s) to which to assign while adding. |
| | expr_n | Expression to assign to optional field(s). |
| | If the current record for this database has been modified, it is written back to the record stream before any other record operation takes place. If an error occurs during this write-back operation (e.g. duplicate key, etc.), an error is generated for this statement. The record remains current, but is now considered to be unchanged so that the next record operation will not attempt another write-back. The ADD statement should be used instead of the BEGIN_INSERT and END_INSERT statements only when most or all of the record information is known at that point. |
| | NOTE |
| | If the ADD fails because of a duplicate key, the optional key expression is used to attempt to get the record that caused the error. This is for upward compatibility and it should not be assumed that this is the correct record if the database has multiple keys. |
| Qualifiers |
 | /Fail=LABEL | Label to which to branch if the statement fails. If LABEL is %EXIT, exit the routine or loop. If in a loop, and LABEL is %CONTINUE, continue the loop. If not in a loop, and LABEL is %CONTINUE, an error message displays. | | |
| | /Succeed=LABEL | Label to which to branch if the statement succeeds. If LABEL is %EXIT, exit the routine or loop. If in a loop, and LABEL is %CONTINUE, continue the loop. If not in a loop, and LABEL is %CONTINUE, an error message displays. | | |
| | /Nofail | Do not signal an error. Instead, set the internal variable %FAIL. | | |
| | /Flush | Flush the record stream so that the record is physically on disk. |
| | /Load | Use the load factor of the RMS datafile if specified. |
| | /Lock=(lock_options, ... ) | Use the following lock options to lock the record if it is automatically retrieved (by accessing a field in that record). |
| | exclusive |  | Lock against all other record streams except READ_REGARDLESS. |
| | manual | | Records remain locked until explicitly unlocked. |
| | none | | Records are not to be locked. |
| | nonexistent | | Proceed with the operation even if the record does not exist (RMS relative files only). |
| | nowait | | Do not wait if the record is locked (return an error). |
| | read | | Lock the record for reading while allowing other record streams to read but not modify (ignored if write also specified). |
| | read_regardless | | Read records even if another record stream has them locked. |
| | wait=n | | Wait n seconds before returning an error if the record is locked. |
| | write | | Lock the record for writing while allowing other record streams to read but not modify. |
| | /Rtype=n | Initialize as record type n (0-255). This is only valid if the FORMAT attribute is set for the database. Refer to the DESCRIBE header procedure for more information. |
| | /Size=n | Initialize the RMS variable length record to a size of n. |