I want to issue a shell command from within a FORTRAN program to the system in order to start another program. The FORTRAN program should wait until the other program finished, and then read the file that the other program produced. I am working on a Windows-10 machine.
I used to do this with the old OpenWatcom compiler with the function
istatus = FSYSTEM(cmdlin)
where cmdlin is a character variabe that contains the command.
PGfortran seems to have the same functionality with the intrinsic function “SYSTEM()”. However, i could not find a description in the PGI manuals but only in those of the GNU compiler. On the other hand, the program compiles without error, but apparently does not wait for the external process to finish.
FORTRAN 2008 has the function “execute_command_line(command,wait)” that is supposed to do this when wait = .true. However, the linker gives an unresolved external error message. I conclude that the “execute_command_line” intrinsic is not implemented in pgfortran, or requires a special library.
If somebody else asked this question before, I could not find it, since any search for “execute_command_line” is split into searches for the individual words, which appear to often to yield useful search results.
thanks for any help, Bernhard