From:"Bachman, William" 
Subject:[NMusers] NONMEM Tips #12 - July 08, 2002 - NONMEM using g77 for Windows
Date:Mon, 8 Jul 2002 15:10:56 -0400

NONMEM Tips #12 - July 08, 2002 - NONMEM using g77 for Windows:

A free FORTRAN compiler for the Microsoft Windows environment is available
from the Free Software Foundation (GNU).  A G77 for Win32 (Windows 95/NT)
package is available from

There are three zip files:    [1,574Kb]  The main executables    [208Kb]    The libraries    [301Kb]    Documentation and other stuff.

You may also need the free 32-bit "unzip.exe" utility that's available from
the same location (  All four files are also available on the 
NONMEM @GloboMax Repository:

Install the compiler as instructed and remember to run g77setup.bat each
time before using the g77 compiler and/or NONMEM (the prefered method is to
add the contents of the batch file to your environment variables).

The compiler appears to operate much like the G77 for LINUX and UNIX

After installing the g77 compiler, NONMEM can be installed and run using the
following instructions. [Adding the g77 environmental variables to your
system is recommended so that you can avoid having to run the g77setup.bat
file every time you run NONMEM.]  You will need three files in addition to
the NONMEM distribution files -  SETUP.bat, NMG77.bat and MAKEG77BAT.

These three files are available from the NONMEM @GloboMax Repository:

NONMEM Installation with g77 for Windows:

1. Create a directory for the g77 NONMEM install, e.g. c:\nmvg77, and copy
the three files, SETUP.bat, NMG77.bat and MAKEG77BAT (no file
extension), to that directory. (Use your NONMEM installation diskettes for
the remaining files or copy the files from the install directory of an
existing installation previously created using setup.bat, e.g. from c:\nmv.)
[Use caution no to overwrite the new setup.bat if you copy files from
directory or diskette.]

2. Make sure g77setup.bat (the file that sets the g77 environmental
variables) is run prior to the installation and prior to all NONMEM runs OR
add the FORTRAN environmental variables to your environment permanently.

3. From a DOS window and in the install directory, run the new setup.bat
installation using appropriate arguments, e.g.
setup a c nmvg77 g77 y

a is the diskette drive
c is the hard drive
nmvg77 is the install directory
g77 is the compiler command
y is optimization

4. At the step 6 "pause" of setup.bat, make the changes to blkdat.for and
flu.for in c:\nmvg77\nm\ specified below and then let the batch program
resume (by pressing any key):

BLKDAT.FOR line 26: Change 'con' to 'nul'.
Note that this change stops attempts to display intermediate output to the
console. There is a problem in g77 which does not permit intermediate output
(FNINT) to to be directed to the DOS console device 'con'.
FLU.FOR line 10: Change "COMMITQQ(I)" to "FLUSH(I)"
This change reflects a difference in dialect for the function which flushes
a file output buffer. 

5. Test the installation by running control5 from the command line, using
nmfe5.bat found in c:\nmg77\run, e.g.:

c:\nmg77\run> nmfe5 control5 report5

[Note: The choice of compiler used to run NONMEM is left to the discretion
the individual user.  This tip is not intended to endorse or discourage use 
of any particular compiler or vendor.  It's sole intent is to inform users 
and increase the awareness of available options for running NONMEM.  It is
responsibility of the end-user to ascertain that the installation was 
successful and that the compiler generates appropriate results.]

Previous tips may be found in the NONMEM Repository@GloboMax:

See the index.txt file for a listing of previous tips.

If you have a "tip" or a better way to do things, by all means, feel free to
post them!  One of the reasons for doing this (other than good PR for
GloboMax), is to stimulate discussion.  We at GloboMax can learn from your
experience as well.
Do you have a "tip" you would like to share, but would prefer to remain
anonymous?  If so, you may forward it to us and your identity will be
withheld.  Distribution as a "Tip of the Week" will be at the discretion of
GloboMax LLC
7250 Parkway Drive, Suite 430
Hanover, MD 21076
Voice: (410) 782-2205
FAX: (410) 712-0737