home *** CD-ROM | disk | FTP | other *** search
- ********************************
- * EXAMPL02.PRG *
- * Written By Gregory A. Martin *
- ********************************
-
- * This example illustrates the fundementals of using G_RLOCK() and G_FLOCK().
-
- DO Startup
-
- * Open the two needed databases
- IF .not. G_Use("ARec", "ARec1, ARec2", "Receive", .f., .f.)
- * If unable to open then return
- RETURN
- ENDIF
- IF .not. G_Use("APay", "APay1, APay2", "Payable", .f., .f.)
- * If unable to open then close first database and return
- SELECT Receive
- USE
- RETURN
- ENDIF
-
- * ... Get some user input ...
-
- SELECT Receive
- SEEK Account1
- * If record not found than append a blank, else lock found record.
- IF G_RLOCK(.not. FOUND())
- REPLACE Receive->AccNum WITH m->Account1
- REPLACE Receive->AccName WITH m->Name1
- UNLOCK
- ELSE
- ErrorBox("Account Not Updated!")
- ENDIF
-
- SELECT Payable
- * Try forever (if needed) to lock file so that it can be SUMmed.
- G_FLOCK("FOREVER")
- SUM AccAmount TO Total
- UNLOCK
-
- * Close databases and return
- SELECT Receive
- USE
- SELECT Payable
- USE
- RETURN
-
-