This example shows that you use the same COBOL program to access different files by setting an environment variable before the programs runs.
Consider a COBOL program that contains the following SELECT clause:
SELECT MASTER ASSIGN TO MASTERA
Suppose you want the program to access either the checking or savings file using the file called MASTER in the program. To do so, set the MASTERA environment variable before the program runs by using one of the following two statements as appropriate, assuming that the checking and savings files are in the d:\accounts directory:
set MASTERA=d:\accounts\checking set MASTERA=d:\accounts\savings
You can use the same program to access either the checking or savings file as the file called MASTER in the program without having to change or recompile the source.