[an error occurred while processing this directive]
Forms Processor Advanced Commands
Contents   Index of Commands   Search the Forms Processor Docs   
set_lock/free_lock Sets or removes an exclusive file access lock. (Used only in rare cases when you write a custom multi-step file update script. Normally, you would not use this parameter, as the form processor handles coordination of multiple simultaneous forms submissions for you automatically when simply inserting data into (or appending data to) an existing file).

&set_lock("filename");
&free_lock("filename");

Example:

# get exclusive access

if (&set_lock("form/count.dat") != 0)

format screen
This service is very busy - please try again!
.

else

&slurp("counter","form/count.dat");
$counter=$counter+1;

format screen
This form has been submitted $counter times.
.

# now save the new value of the counter

format file form/count.dat overwrite
$counter
.

# release the lock

&free_lock("form/count.dat");

endif


See also:   Detailed explanation for the example above [an error occurred while processing this directive]