FIX: D2031 Not Generated w/ More Than 121 Files, *.FOR (86064)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN compiler for OS/2 5.0

This article was previously published under Q86064

SYMPTOMS

The Microsoft FORTRAN version 5.0 compiler may fail to generate the command-line error
D2031: Too Many Command-Line Arguments
during pass one of the compiler if more than 121 files are in the current directory and all the files are being compiled using the command line:

fl *.for

The compiler compiles the first 125 files but after that it stops and generates the message:
Out Of Memory
It may also generate the command-line error:
D2013: Too Many Linker Arguments

RESOLUTION

To avoid this problem, the user may create several subdirectories with all the different files divided in small groups (perhaps 100 or less files per directory.)

Alternatively, create an NMAKE file to build the project containing all the files for the final executable. Make sure to create a response file for the linker because it has a limit on the number of arguments you can send on an MS-DOS command line.

STATUS

Microsoft has confirmed this to be a problem in Microsoft FORTRAN version 5.0 for MS-DOS and OS/2. This problem was corrected in Microsoft FORTRAN version 5.1.

MORE INFORMATION

The following program generates 200 FORTRAN source files. After the program is finished, on the directory where it created the FORTRAN files, compile all the files by typing the command:

FL *.FOR

Sample Code

This program generates the source files for the test compilation.
        CHARACTER*12 FileName
      CHARACTER*7 tmp
      INTEGER i
      DO 10, i = 1, 200
         WRITE (tmp, '(A4, I3)') 'TEST', i
         IF (i .LT. 10) THEN
           tmp(5:6) = '00'
           FileName = tmp // '.FOR'
         ELSE IF (i .LT. 100) THEN
                tmp(5:5) = '0'
                FileName = tmp // '.FOR'
              ELSE
                FileName = tmp // '.FOR'
         ENDIF
         PRINT *, FileName
         OPEN (1, FILE=FileName)
         WRITE (1, *) '      SUBROUTINE HelloWorld ()'
         WRITE (1, *) '      END'
         CLOSE (1)
 10   CONTINUE
      END
				

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:kbfix KB86064