A cycle module having exported subprocedures introduces potential
scenarios where the cycle-main procedure initialization is performed
at an unexpected time, with the effect that has on files, data area
locks, and global data then leading to errors. An exported subprocedure
can be called first in the module, from a procedure outside the module,
before the cycle-main procedure is called. If the cycle-main procedure
is then called, it will initialize at that time.
- If module initialization occurs because a subprocedure is the
first procedure to be called, and cycle-main procedure initialization
occurs later, errors can occur if files are already open or data areas
are already locked.
- If a subprocedure calls the cycle-main procedure, global data
may or may not be reinitialized during the call, depending on the
way the main procedure ended the last time it was called. If the subprocedure
is using any global data, this can cause unexpected results.
- If the cycle-main procedure was last called and ended and implicitly
closed the files and unlocked the data areas, and an exported subroutine
is then called from outside the module, errors can occur if it expects
those files to be open or data areas to be locked.