If you need to override the default locations and names for input/output files, you can use the following methods without making any changes to the source code.
To give a specific name to a file that would usually have a name of the form fort.unit, you must set the run-time option unit_vars, and then set an environment variable with a name of the form XLFUNIT_unit for each scratch file.
The association is between a unit number in the Fortran program and a path name in the file system.
For example, suppose that the Fortran program contains the following statements:
OPEN (UNIT=1, FORM='FORMATTED', ACCESS='SEQUENTIAL', RECL=1024) ... OPEN (UNIT=12, FORM='UNFORMATTED', ACCESS='DIRECT', RECL=131072) ... OPEN (UNIT=123, FORM='UNFORMATTED', ACCESS='SEQUENTIAL', RECL=997)
XLFRTEOPTS="unit_vars=yes" # Allow overriding default names. XLFUNIT_1="/tmp/molecules.dat" # Use this named file. XLFUNIT_12="../data/scratch" # Relative to current directory. XLFUNIT_123="/home/user/data" # Somewhere besides /tmp. export XLFRTEOPTS XLFUNIT_1 XLFUNIT_12 XLFUNIT_123
Notes:
To place all scratch files in a particular directory, set the TMPDIR environment variable to the name of the directory. The program then opens the scratch files in this directory. You might need to do this if your /tmp directory is too small to hold the scratch files.
To give a specific name to a scratch file, you must do the following:
The association is between a unit number in the Fortran program and a path name in the file system. In this case, the TMPDIR variable does not affect the location of the scratch file.
For example, suppose that the Fortran program contains the following statements:
OPEN (UNIT=1, STATUS='SCRATCH', & FORM='FORMATTED', ACCESS='SEQUENTIAL', RECL=1024) ... OPEN (UNIT=12, STATUS='SCRATCH', & FORM='UNFORMATTED', ACCESS='DIRECT', RECL=131072) ... OPEN (UNIT=123, STATUS='SCRATCH', & FORM='UNFORMATTED', ACCESS='SEQUENTIAL', RECL=997)
XLFRTEOPTS="scratch_vars=yes" # Turn on scratch file naming. XLFSCRATCH_1="/tmp/molecules.dat" # Use this named file. XLFSCRATCH_12="../data/scratch" # Relative to current directory. XLFSCRATCH_123="/home/user/data" # Somewhere besides /tmp. export XLFRTEOPTS XLFSCRATCH_1 XLFSCRATCH_12 XLFSCRATCH_123
Notes: