fortran program running multiple times unwanted

Hi all,

I’ve just started using the PGI software and I’ve written a simple 2D random walk of many points program in Fortran using Cygwin and the PGI compilers. For some reason, after making some changes in one of the subroutines, the executable created runs the whole program six times. I currently have the program in one file and three subroutines in a separate file.

Does anybody know where I should be looking for an error in my code, or what the problem might be?

Also, when I compile my code I get three output files: an exe, a pdb, and a dwf. Is there some way I can use an option to only output an exe?

Thanks for any help.

Problem solved.

I was unaware of the function MODULO and its difference to MOD, and using MOD within a single subroutine was somehow causing the whole program (and its multiple subroutines) to run a number of times.

The significant bit of NOW FIXED code (MODULO used to be MOD) is:

ynew = y
xnew = MODULO(x-d,cols)+1