PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

Using the include Statement

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
clueless



Joined: 28 Sep 2011
Posts: 2

PostPosted: Wed Sep 28, 2011 8:41 am    Post subject: Using the include Statement Reply with quote

Hi,

I have a suite of programs that were written for the unix environment that I am trying to compile in a windows environment (pgi workstation 11.7 (64)) with no sucess. We have narrowed down that the problem seems to be with the INCLUDE statement in that it is not reading the file properly. It was suggested to me that someone here may be able to help me. To simplify things I have deleted most of the code and just included the problem pieces.

My source code (Csumnvpi.F) is as follows

SUBROUTINE SUMM
INCLUDE 'INPARAN.F'
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INTEGER MCATEG
PARAMETER (MAXG=MCATEG)
print *,MAXG
print *,MCATEG
end

The INPARAN.F file is

PARAMETER(MCATEG=735)
END

I have been compling it with the following command

pgf77 Csumnvpi.F

When I change PARAMETER (MAXG=MCATEG) to be PARAMETER (MAXG=100) it compiles and my print statement for MAXG is 100. However, it is not reading in MCATEG variable (the print statement for this is 0).

I am not a programmer so hopefully I have included all the information needed.
Can anyone help?

Thanks

Kirsty
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6667
Location: The Portland Group Inc.

PostPosted: Wed Sep 28, 2011 10:49 am    Post subject: Reply with quote

Hi Kristy,

The "INCLUDE" statement basically copies the entire contents of the file into this spot. Hence, you should be getting a syntax error since your INPARAN.F contains an "END" statement.

Code:
PGI$ pgf77 test.f -o test1.exe
PGFTN-S-0087-Non-constant expression where constant expression required (test.f:4)
  0 inform,   0 warnings,   1 severes, 0 fatal for MAIN
PGFTN/x86-64 Windows 11.9-0: compilation completed with severe errors


Though, when I remove the 'END', the code compiles and runs as expected:
Code:
PGI$ cat test.f
        INCLUDE 'INPARAN.F'
        IMPLICIT DOUBLE PRECISION (A-H,O-Z)
        INTEGER MCATEG
        PARAMETER (MAXG=MCATEG)
        print *,MAXG
        print *,MCATEG
        end
PGI$ cat INPARAN.F
        PARAMETER(MCATEG=735)
PGI$ pgf77 test.f -o test1.exe
PGFTN-W-0119-Redundant specification for mcateg (test.f: 3)
  0 inform,   1 warnings,   0 severes, 0 fatal for MAIN
PGFTN/x86-64 Windows 11.9-0: compilation completed with warnings
PGI$ test1.exe
          735
          735
PGI$


This seems to suggest that INPARAN.F isn't getting included or is blank. On Windows, file names are not case sensitive so 'INPARAN.F' and 'inparan.f' are the same. If you are doing any pre-processing, then you could be overwriting the file.

Can you try the above example and see if it works for you?

- Mat
Back to top
View user's profile
clueless



Joined: 28 Sep 2011
Posts: 2

PostPosted: Thu Sep 29, 2011 5:31 am    Post subject: Reply with quote

Hi Mat,

Many thanks for your help. I tried what you said it worked.

Cheers

Kirsty
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group