Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Example: using different input files

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.


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)