5.4 Manipulation of files HREF="./Modulef.css" TITLE="Modulef CSS"> ALT="Modulef"> ALT="previous"> ALT="up"> ALT="next"> ALT="contents"> ALT="index"> ALT="[BIG]"> ALT="[Normal]"> ALT="[small]"> Next: Part III: Description of Data Structures Up: 5 Diverse utilities Prev: 5.3 Obtaining general information >Index >Contents 5.4 Manipulation of files Utility DEFDIR SUBROUTINE DEFDIR( , , , ) INTEGER UNIT, IPGD, ILON, M(*) It is advisable to call this utility after opening all the direct access files. In reality, it is only obligatory to call this utility before a call to modules using MEFDIR (manipulation of direct access files with the aid of utilities OUVDIR, LECDIR, ECRDIR, FERDIR, ..., is voluntarily omitted in this user guide). Since the implementation of the [Fortran 77] standard, it is possible to avoid the use of MEFDIR by using the OPEN, READ, WRITE and CLOSE commands directly. UNIT is the unit number of the file (only its absolute value is considered). IPGD is the largest page number that the file may contain. ILON is the length of a page in words. M is the super-array (unused). Utility OUVRIR SUBROUTINE OUVRIR( , , , , ) INTEGER UNIT, RECL, IOSTAT CHARACTER*(*) FILE, SPEC This utility opens a file (see also OUVRIS). The call to this utility ensures an improved portability than the direct use of the OPEN command. UNIT is the file unit number. In an OPEN command, this number appears after keyword UNIT. FILE is the file name. In an OPEN command, this name appears after keyword FILE, except if it equals ' '. SPEC is the list of specifications. In an OPEN command, the specifications appear after keywords STATUS, ACCESS, FORM, BLANK, where: STATUS = OLD, NEW, SCRATCH or UNKNOWN ACCESS = SEQUENTIAL or DIRECT FORM = FORMATTED or UNFORMATTED BLANK = NULL or ZERO These specifications can be given in any order, separated by commas, blanks being ignored. The default values are those of the [Fortran 77] standard: STATUS = UNKNOWN ACCESS = SEQUENTIAL FORM = FORMATTED if ACCESS = SEQUENTIAL, or UNFORMATTED if ACCESS = DIRECT BLANK = NULL RECL is the record length, in machine-units (see IINFO('RECL')). In an OPEN command, this length appears after keyword RECL. IOSTAT is the return code. In an OPEN command, this code appears after keyword IOSTAT. If no error occured at the opening, IOSTAT = 0. An example of a call: CALL OUVRIR(10, 'POBA.DIRECT', 'OLD, DIRECT', 1024, IOSTAT) Utility OUVRIS SUBROUTINE OUVRIS( , , , ) INTEGER UNIT, RECL CHARACTER*(*) FILE, SPEC This utility opens a file and stops execution in case of an error. It is therefore unnecessary for the programmer to do the following test: CALL OUVRIR(UNIT,FILE,SPEC,RECL,IOSTAT) IF (IOSTAT.NE.0) CALL ARRET(IOSTAT) Utility TRUNIT SUBROUTINE TRUNIT( ) INTEGER UNIT This utility finds a free unit number, i.e. connected to no other file. It is often called before OUVRIR. ALT="Modulef"> ALT="previous"> ALT="up"> ALT="next"> ALT="contents"> ALT="index"> ALT="[BIG]"> ALT="[Normal]"> ALT="[small]"> Next: Part III: Description of Data Structures Up: 5 Diverse utilities Prev: 5.3 Obtaining general information >Index >Contents