To do safe Launcher Office programs concerning concurrent accesses, it is necessary to control shared resources accesses and making sure they will not be used simultaneously.
For
instance, assuming a program using the "a.txt" file with DBXFER
command.
This program is safe in terms of competitive access to a program B that would
use the "b.txt" file, but not in relation to itself.
Therefore, we have to make sure that program A is never run simultaneously, or solve the critical resource problem.
There are different ways to solve the above problem :
o Using a variable file name (to be set by program). This seems to be the best solution as it enables several program A instances to run fully simultaneously.
%CONID% variable assures this unicity to a particular LAUNCHER Office instance (care must be taken to files used by several stations being on the network).
o Using a 'critical section' with LAUNCHER 'CRITSECT' command. This command will protect a common resource.
In this case, just before using the a.txt file, enter the following command
LNCCMD CMD(CRITSECT) PARM1('Name="ProgramA";Enter')
Then, just after :
LNCCMD CMD(CRITSECT) PARM1('Name="ProgramA";Leave')
It will always be better to avoid conflict (when possible) instead of using critical sections.
Critical sections are automatically released with LNCCLOSE command.