Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

compile fortran code from other fortran code

juan_v_
Beginner
298 Views

Dear all,

I would like to ask you something I am trying to do in fortran. I am trying to compiling a fortran code from another frotran code. I am doing this using call system command as follows,

call system (" newfile/abaqus job=analisis user=Juan_Reaccion_Difusion_Poro_1 ")

 

where newfile is the file where is located the second fortran code and abaqus job=analisis user=Juan_Reaccion_Difusion_Poro_1 is the command to compile the code located in that file.

 

I have had problems because it does not work.

 

I apprecciate you collaboration whit this

 

Sincerely

Juan

0 Kudos
5 Replies
Steven_L_Intel1
Employee
298 Views

How does it "not work"? Is "newfile" a directory in your current directory? Maybe try "./newfile" instead - I often find I need to add the dot.

Also, note that Intel Fortran supports the Fortran standard EXECUTE_COMMAND_LINE intrinsic procedure, so you could write:

call EXECUTE_COMMAND_LINE(" ./newfile/abaqus job=analisis user=Juan_Reaccion_Difusion_Poro_1 ")

There are optional arguments to get a status and whether or not to wait.

0 Kudos
juan_v_
Beginner
298 Views

Dear Lionel,

I did your recomendadtion but did not work. If I use EXECUTE_COMMAND_LINE, it says that the command is not recognized. I did the same with call system but it says that the dot is not recognized as a command.

Now I'm trying to do another thing that consist in create a .bat file that contains the next secuence.

@echo off

cd newfile
call C:\SIMULIA\Abaqus\Commands\abaqus job=analisis user=Juan_Reaccion_Difusion_Poro_1.for

exit

 

If I open this file it will run the code that is located in the file "newfile". It is working manually. But now I'm trying to include a routine in the main fortran code to execute this .bat file and I ahve not find a solution yet.

 

0 Kudos
Steven_L_Intel1
Employee
298 Views

Now you're on Windows? Your original question showed Linux file path syntax and this is the Linux forum. If you are on Windows then you would want:

call EXECUTE_COMMAND_LINE("newfile\abaqus job=analisis user=Juan_Reaccion_Difusion_Poro_1 ")

0 Kudos
juan_v_
Beginner
298 Views

Yes, I am on Windows, and the comand call EXECUTE_COMMAND_LINE is not recognized by the fortran I'm using

0 Kudos
Steven_L_Intel1
Employee
298 Views

Then go back to using SYSTEM. But this tells me you're using a version older than 15.0 (16.0 is current and 17.0 will be released soon), so I recommend you try to get more up to date.

0 Kudos
Reply