Method 2

Using the TITLE option on the OPEN statement allows one to specify an explicit disk file name with an optional directory prefix. The use of the TITLE option takes precedence over method 1.

Example

dcl Payroll file input; 
open file(Payroll) title ('/global/acct/sep-95.days')

A file named /global/acct/sep-95.days will be used for all I/O operations using file Payroll.

dcl Payroll file input; 
dcl filename character(100) varying; 
<assignment into filename> 
open file(Payroll) title (filename); 
                                   /* Using a variable name */

The value of filename determines the file that will be used for all I/O operations using file Payroll.

Note:

Once the file has been opened, changing the value of filename will have no impact. The association is made only once, at the time of the open.