It is extremely important to terminate called programs properly. Failure to
terminate a called program properly can cause damage to production data if you
think you're using test data to test program modifications.
Suppose your production library list consists of production data files (PRODF)
and production programs (PRODP). Now, suppose your test library list consists
of test data files (TESTF), programs in testing (TESTP), and production
programs (PRODP).
PRODP contains only executable programs, print files, and display files. This
way, duplicates of these objects do not need to be kept in the test libraries.
TESTP contains only programs that are actually in testing. Many shops use
similar library list structures.
Here's how damage can occur.
1. You execute PRODP/PGMA. This program calls PRODP/PGMB, which opens
PRODF/FILE1. Then, PGMB terminates with a RETRN statement. Control is returned
to PGMA, but PGMB remains resident and PRODF/FILE1 remains open.
2. You terminate PRODP/PGMA and set up your test library list to test
modifications to PGMA. PGMB has not been modified.
3. You call TESTP/PGMA, which calls PGMB. Since PGMB is not in testing,
PRODP/PGMB is called. But PRODP/PGMB is already resident, and its files are
open. Therefore, your test affects PRODF/FILE1. You've compromised your
production data, thinking you were in your test environment.
To prevent this problem, make PGMA pass a parameter telling PGMB to set on its
LR indicator. This method may not be practical if this error is widespread
throughout your software (as is the case with some commercially available
software packages.)
Another solution is to execute the Reclaim Resource (RCLRSC) command in the CL
program that calls PGMA. This technique disposes of stray resident programs and
closes the files associated with them.
If you use CL programs to set up your library list, a simple solution is to put
the RCLRSC command at the beginning of those programs. Any stray programs left
over from production processing will be cleaned up before you start testing and
vice versa.
--Sam Stafford
LATEST COMMENTS
MC Press Online