FILES, LOGICAL NAMES AND PHYSICAL NAMES

In dealing with the files, programs using the I/O API refer to files by logical names, instead of forcing the programmer and program-user to deal with hard-coded file names or hard-coded unit numbers. One of the consequences of this is that multiple copies of a program executing at the same time do not interfere with each other, since each execution has its own separate "space" for environment variables. As a modeler, you can define your own logical names as properties of a program (or even prompt the user for his own preferred logical names at run time) and then at run-time connect up the logical names to any "real" file name you want to, using the UNIX csh setenv command. For programming purposes, the significant facts are that names should not contain blanks (except at the end: 'BAR ' is OK; 'B AR' is not), and are at most 16 characters long. Logical names (environment variables) may also be used to control program options and flags; in that case, the routines ENVDBLE , ENVINT , ENVREAL , ENVSTR , ENVYN , and NAMEVAL() may be used to get the value associated with the an environment variable.

The I/O API also uses a standard set of logical names LOGFILE, SCENDESC, and EXECUTION_ID for the program's log, the scenario/run description file, and the run's execution ID. Routine DSCGRID() uses a grid and coordinate description file with logical name GRIDDESC .

When you run a program that uses the I/O API, you begin with a sequence of setenv commands that set the values for the program's logical names, much as you begin a (normal) Cray Fortran program with a sequence of ASSIGN commands for its files. For example, if myprogram has logical names FOO and BAR that I want to connect up to files somedata.mymodel and otherdata.whatever from directory /tmp/mydir, the script for the program would look something like:

    ...
    setenv  FOO  /tmp/mydir/somedata.mymodel
    setenv  BAR  /tmp/mydir/otherdata.whatever
    /user/mydir/myprogram
    ...

Note that you can declare a file "volatile" by adding a trailing (and quoted, so that setenv works correctly)  -v to the value of the logical name, as indicated below; this has the effect of telling the I/O API to do a disk-synch before or after every input or output operation on that file.

    ...
    setenv  QUX  "/tmp/mydir/volatiledata.mymodel -v"


Next Section: Standard environment variables

Up: Conventions

To: Models-3/EDSS I/O API: The Help Pages