CLOSE3() and close3c()

Fortran version:

    LOGICAL FUNCTION  CLOSE3( FNAME )
        CHARACTER*(*)   FNAME   !  file name for query

C version:

    int close3c( const char * fname ) ;
close3c() is a C wrapper calling the Fortran CLOSE3()

See also:

SHUT3(), which flushes and closes all I/O API files currently open, and
M3EXIT(), which is a program-shutdown wrapper around SHUT3().

Summary:

Flushes the file with file with logical name FNAME to disk, then closes it. Returns .TRUE. or 1 if it succeeds at closing the file, or .FALSE. or 0 otherwise.

If FNAME is invalid, writes an error message indicating the nature of the problem to the log and returns a FALSE (or 0).

Normally should not be used from within science modules, since it can cause modularity violations with respect to what files other modules think have been opened. (There is no way to keep track of how many modules are in fact using a file, and close it only after all of them have issued a CLOSE3() call for it.)

Preconditions:

INCLUDE 'IODECL3.EXT' for Fortran, or #include "iodecl3.h" for C.

FNAME must have length at most 16.

JDATE and JTIME must be expressed in terms of Models-3 date and time conventions.

FNAME must already have been opened by OPEN3() or open3c() and the I/O API must have been initialized with INIT3() or init3c() ).

Fortran Usage:

    ...
    INCLUDE 'IODECL3.EXT'
    ...
    ...
    IF ( CLOSE3( 'MYFILE' ) ) THEN
C              MYFILE successfully flushed to disk, and closed.
        ...
    END IF
    ...

C Usage:

    ...
    #include "iodecl3.h"
    ...
    if ( close3c( "MYFILE" ) )
        {
            /*  MYFILE successfully flushed to disk, and closed.  */
        ...
        }
    ...


Previous: CHECK3

Next: DDTVAR3

Up: Public I/O Routines

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