Increase Number of File Handles, FORTRAN 5.0 and 5.1

ID: Q70633


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0, 5.1


SUMMARY

To obtain the application note "Increasing the Number of File Handles in FORTRAN 5.0/5.1 with Large Model Libraries," call Microsoft Product Support Services.

This application note is also available in the Microsoft Software Library.


MORE INFORMATION

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:

hf0304.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. This application note eliminates the run-time error F6417 -- too many open files when opening more than 15 files at a time in a FORTRAN program. The error message will reappear when opening more than 50 or 120 files at a time, depending on which object module the program is linked with.

The following is the text of the application note:

======================================================================
    Microsoft Product Support Services Application Note (Text File)
           HF0304: INCREASING THE NUMBER OF FILE HANDLES IN
         FORTRAN 5.0 AND 5.1 WITH LARGE MEMORY MODEL LIBRARIES
======================================================================
                                                  Revision Date: 10/91
                                                         Disk Included

The following information applies to Microsoft FORTRAN versions 5.0
and 5.1.

 --------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
| ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
| Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
| PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
| accuracy and the use of this Application Note. This Application    |
| Note may be copied and distributed subject to the following        |
| conditions: 1) All text must be copied without modification and    |
| all pages must be included; 2) If software is included, all files  |
| on the disk(s) must be copied without modification [the MS-DOS(R)  |
| utility DISKCOPY is appropriate for this purpose]; 3) All          |
| components of this Application Note must be distributed together;  |
| and 4) This Application Note may not be distributed for profit.    |
|                                                                    |
| Copyright 1990-1991 Microsoft Corporation. All Rights Reserved.    |
| Microsoft, MS-DOS, and the Microsoft logo are registered           |
| trademarks and Windows is a trademark of Microsoft Corporation.    |
 --------------------------------------------------------------------

INTRODUCTION
============

The following files are included on the enclosed HF0304 disk:

   Directory               Filename       Description
   ---------               --------       -----------

   \FORT500\F120           UNIT.OBJ       Modified UNIT.ASM for 120
                                          file handles to be linked
                                          with DOS or OS/2 executable
                                          files

   \FORT500\F120\DOS       CRT0DAT.OBJ    Modified CRTODAT.ASM for 120
                                          file handles to be linked
                                          with DOS executable files

   \FORT500\F120\OS2       CRT0DAT.OBJ    Modified CRTODAT.ASM for 120
                                          file handles to be linked
                                          with OS/2 executable files

   \FORT500\F50            UNIT.OBJ       Modified UNIT.ASM for 50
                                          file handles to be linked
                                          with DOS or OS/2 executable
                                          files

   \FORT500\F50\DOS        CRT0DAT.OBJ    Modified CRTODAT.ASM for 50
                                          file handles to be linked
                                          with DOS executable files

   \FORT500\F50\OS2        CRT0DAT.OBJ    Modified CRTODAT.ASM for 50
                                          file handles to be linked
                                          with OS/2 executable files

   \FORT510                UNIT.OBJ       Modified UNIT.ASM for 64
                                          file handles to be linked
                                          with Windows executable
                                          files or Windows DLLs

   \FORT510                CRT0DATD.OBJ   Modified CRTODAT.ASM for 64
                                          file handles to be linked
                                          with Windows DLLs

   \FORT510                CRT0DATL.OBJ   Modified CRTODAT.ASM for 64
                                          file handles to be linked
                                          with Windows executable
                                          files

The original versions of CRT0DAT.ASM and UNIT.ASM are located on the
distribution disks for Microsoft FORTRAN versions 5.0 and 5.1. The
exact locations of these files are shown in the PACKING.LST file
located on Disk 1, Setup. Page 405 of the "Microsoft FORTRAN
Reference" manual for both versions 5.0 and 5.1 describes the
modifications made to CRT0DAT.ASM and UNIT.ASM to increase the number
of file handles. The assembled versions of these two files,
CRT0DAT.OBJ and UNIT.OBJ, are included on the enclosed HF0304 disk for
use with large memory model FORTRAN 5.0 libraries. The files CRT0DATL
.OBJ and CRT0DATD.OBJ are included on the enclosed disk for use with
large memory model FORTRAN 5.1 Windows or Windows DLL libraries.


FORTRAN VERSION 5.0
===================

Increasing the Number of File Handles to 50 -- DOS or OS/2
----------------------------------------------------------

1. Add the file CRT0DAT.OBJ to your current directory. This file is
   located on the enclosed HF0304 disk in the \FORT500\F50\DOS
   directory (or the \FORT500\F50\OS2 directory, if you are using
   FORTRAN with OS/2).

2. Add the file UNIT.OBJ to your current directory. This file is
   located on the enclosed HF0304 disk in the \FORT500\F50 directory.

3. Change the FILES=<number> line in your CONFIG.SYS file to read as
   follows:

      FILES=50

   Add this line to your CONFIG.SYS file if the line does not exist.
   Reboot the machine so the new FILES= statement takes effect.

4. Link the .OBJ files with the FORTRAN.OBJ file using the following
   statement

      LINK /NOE <QUUX.OBJ> + UNIT.OBJ + CRT0DAT.OBJ;

   where <QUUX.OBJ> is the FORTRAN object code.

5. Alternatively, for a more permanent change, you can replace these
   object modules in the run-time library <libraryname> as follows:

      LIB <libraryname> -+UNIT.OBJ -+CRT0DAT.OBJ;


Increasing the Number of File Handles to 120 -- DOS or OS/2
-----------------------------------------------------------

1. Add the file CRT0DAT.OBJ to your current directory. This file is
   located on the enclosed HF0304 disk in the \FORT500\F120\DOS
   directory (or the \FORT500\F120\OS2 directory, if you are using
   FORTRAN with OS/2).

2. Add the file UNIT.OBJ to your current directory. This file is found
   on the enclosed HF0304 disk in the \FORT500\F120 directory.

3. Change the FILES=<number> line in your CONFIG.SYS file to read as
   follows:

      FILES=120

   Add this line to your CONFIG.SYS file if the line does not exist.
   Reboot the machine so the new FILES= statement takes effect.

4. Link the .OBJ files with the FORTRAN.OBJ file using the following
   statement

      LINK /NOE <QUUX.OBJ> + UNIT.OBJ + CRT0DAT.OBJ;

   where <QUUX.OBJ> is the FORTRAN object code.

5. Alternatively, for a more permanent change, you can replace these
   object modules in the run-time library <libraryname> as follows:

      LIB <libraryname> -+UNIT.OBJ -+CRT0DAT.OBJ;


FORTRAN VERSION 5.1
===================

Increasing the Number of File Handles to 64 -- DOS or OS/2
----------------------------------------------------------

The document FILEHAND.DOC, contained on the Microsoft FORTRAN version
5.1 distribution Disk 5, describes where to find the object modules on
the distribution disks to increase the number of file handles to 64
for both DOS and OS/2. The document also describes the process of
linking these object modules with the executable file.

Increasing the Number of File Handles to 64 -- Windows
------------------------------------------------------

The files CRT0DATD.OBJ and CRT0DATL.OBJ, shipped with Microsoft
FORTRAN version 5.1, may generate an L2029, L2044, or L2025 error
during link time when attempting to increase the number of file
handles to 64 for a Windows executable file. The files CRT0DATD.OBJ
and CRT0DATL.OBJ on the enclosed HF0304 disk are corrections for the
object modules shipped with Microsoft FORTRAN 5.1.

1. Add the files CRT0DATL.OBJ and CRT0DATD.OBJ to your current
   directory. These files are located on the enclosed HF0304 disk in
   the \FORT510 directory.

2. Add the file UNIT.OBJ to your current directory. This file is
   located on the enclosed HF0304 disk in the \FORT510 directory.

3. Change the FILES=<number> line in your CONFIG.SYS file to read as
   follows:

      FILES=64

   Add this line to your  CONFIG.SYS file if the line does not exist.
   Reboot the machine so the new FILES= statement takes effect.

4. Link the .OBJ files with the FORTRAN object code file to create a
   Windows executable file using the following statement

      LINK /NOE <QUUX.OBJ> + UNIT.OBJ + CRT0DATL.OBJ;

   where <QUUX.OBJ> is the FORTRAN object code. Use CRT0DATD.OBJ in
   place of CRT0DATL.OBJ to create a Windows DLL.

5. Alternatively, for a more permanent change, you can replace these
   object modules in the run-time library as follows:

   a. To change the Windows run-time library, rename CRT0DATL.OBJ to
      CRT0DAT.OBJ and type:

         LIB LLIBFEW.LIB -+UNIT.OBJ -+CRT0DAT.OBJ;

   b. To change the Windows dynamic-linked library, rename
      CRT0DATD.OBJ to CRT0DAT.OBJ and type:

         LIB LDLLFEW.LIB -+UNIT.OBJ -+CRT0DAT.OBJ; 

Additional query words:

Keywords : kbfile
Version : :5.0,5.1
Platform :
Issue type : kbinfo


Last Reviewed: November 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.