The QMWrite() function writes a record. This is analogous to the QMBasic WRITE statement.
The function arguments are:
The QMWrite function writes the given data to the file opened as FileNo. If a record with this Id already exists, it is replaced. If the record does not already exist, it is added.
An application should always obtain an update lock on the record before writing it. This function releases the lock.
When writing a new record to a directory file on a Linux or Unix system, the operating system level file that represents the QM record is created using the umask value specified by the UMASK configuration parameter or, if this parameter is not present, a default of 002. This behaviour can be modified by executing a UMASK command either from the LOGIN paragraph or by using the QMExecute() function.
The example program fragments below read a record with an update lock, modify it and then write it back to the file. A real program should test the error status from the read operations to determine if they were successful.