Previous Topic: #KEEP Status CodesNext Topic: #LINEEND—requests termination of the current line I/O session


#KEEP Example

The following is an example of the #KEEP statement that requests that the system monitor the database activity of a record. The #KEEP NOTIFY statement selects an EMPLOYEE record that is current of the EMPLOYEE record type and assigns it a long-term lock ID of REC1. Use of the NOTIFY parameter causes the system to initialize register 0, which will receive the information regarding database activities.

The #KEEP TEST statement calls on the system to return the database activity information for the record identified by a lock ID of REC1 to the low-order byte of register 0. The information is returned as a numeric value and is tested by comparing the value in register 0 to the numeric literal that contains the value 2. If the value in register 0 is greater than or equal to 2, the program will branch to location MODREC. If the value is less than the value of register 0 the program will proceed to the next statement.

#KEEP NOTIFY,LONGID='REC1',CURRENT='EMPLOYEE'
.
.
.
#KEEP TEST,LONGID='REC1'
C (R_),=F'2'
BNL MODREC
.
.