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

Can I define a variable in a bat file?

hupo1982
Beginner
452 Views
Now I'm developping a 64bit program. I define some variables in a batfile,but when I build my project I getting error that the variableis not declear as an array or a function. The everything will be OK when I changed my dat file to another file type.
I have many code files, I don't want to change my dat file's type, what should I do ?
0 Kudos
3 Replies
hupo1982
Beginner
452 Views
My compiler is Intel Fortran 9.0
0 Kudos
emc-nyc
Beginner
452 Views
How are you declaring a fortran variable in a bat file? You can declare environment variables in bat files, and determine their values by using a system call, and go from there. You cannot declare a variable in a bat file and have it recognized by Fortran!

What you may be trying to do is to declare a variable to be interpreted by the Fortran pre-processor (FPP), which does variable substitution in a copy of the source file.

So ... there are two choices.

1) Declare variable in bat file
Read value of variable via system call (getenvqq)
Act on value of variable

2) Declare variable in bat file
Pass Fortran program with appropriate preprocessor statements through fpp, (or, if you prefer, cpp), thence to compiler.

No higher level language of which I am aware can use a variable declared in a different language. From my personal experience one cannot do it in C, C++, Fortran, PL/1, Cobol, SQL, JCL, DCL.....

Message Edited by emc-nyc on 09-06-2005 10:17 AM

0 Kudos
hansr
Beginner
452 Views
DAT or BAT? That's the question.
Hans
0 Kudos
Reply