View previous topic :: View next topic |
Author |
Message |
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Wed Sep 17, 2014 11:55 am Post subject: Compiler error msg |
|
|
Hi Group,
I am getting a compiler error msg which reads:
Quote: | error 1090 - Character substrings are not permitted in this context |
Its the last line of the following code which the compiler is issuing the error against:
Code: | OPEN(4,FILE='FPT1_RUN.BAT')
OPEN(1,FILE='GEN_TEMP.PAR')
READ(1,'(A)',ERR=199)FLE1
199 CLOSE(1)
WRITE(4,*)'@WIN /R CUTEDITJ '//CDIP(25,L)(:L)//FLE1 |
As I understand it the code sytax was good for Fortran 77, any ideas please? _________________ Regards
Mike |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Sep 17, 2014 12:33 pm Post subject: |
|
|
It works OK for me. Here is my test...
Code: | character*10 cdip(5,5),FLE
integer L
L = 1
CDIP(5,L) = 'TEST'
FLE = 'OK'
WRITE(*,*)'@WIN /R CUTEDITJ '//CDIP(5,L)(:L)//FLE
end |
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Wed Sep 17, 2014 1:12 pm Post subject: |
|
|
When I did cut'n'paste I got that last line to run to col 70. Is there maybe a tab in the original source that extends the line over col 72?
E |
|
Back to top |
|
|
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Wed Sep 17, 2014 1:26 pm Post subject: |
|
|
Hi E,
I have checked the source for none printable chars and whilst it originally contained LF chars it seems to be clean.
I assume from your comment that the syntax appears ok to you?
Thank you for your comments _________________ Regards
Mike |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Sep 18, 2014 1:46 pm Post subject: |
|
|
Mike,
I tried compiling the code you sent me, and with FTN95 v6.35 it compiles with no errors (after I'd sorted out the INCLUDEs) Using version 7.00 PE it throws the error message you noted. This seems to me to be something for Paul to look at with your code and includes as his little demo works.
Eddie |
|
Back to top |
|
|
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Thu Sep 18, 2014 1:55 pm Post subject: |
|
|
Thank you for your time Eddie, how do I get the code to Paul doyou have an email address ?
Is there a version 6.35 PE which I could download? _________________ Regards
Mike |
|
Back to top |
|
|
mike.smartcam
Joined: 02 Aug 2014 Posts: 40 Location: Lancashire, United Kingdom
|
Posted: Thu Sep 18, 2014 2:20 pm Post subject: |
|
|
Hi Paul,
I have uploaded the problem files to dropbox with the following link:
https://www.dropbox.com/sh/rx7cam71dnhp7nz/AABPTwDXAkD_kRrQKAXda442a?dl=0
From the thread I am sure you will see that the problem appears to be caused when using v7 PE of the FTN95 compiler.
Should you have any problems or require further details please let me know. _________________ Regards
Mike |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 18, 2014 5:47 pm Post subject: |
|
|
I have had a quick look at your code and initial problems are
a) DIP is used as both the name of a common block and the name of a variable
b) LEN is the name of a standard intrinsic and also the name of a variable.
If you change these then you may be able to make progress. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Sep 18, 2014 7:20 pm Post subject: |
|
|
Compiled with v6.35 though!
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 18, 2014 8:55 pm Post subject: |
|
|
I get the same error reports with v6.35. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Thu Sep 18, 2014 9:21 pm Post subject: |
|
|
Bizarre. Paul, you may be right about the duplication of names thing.
I renamed Mike's file to M.f95, put the INCLUDEs in the same folder and edited the paths to fit, and used the command line:
FTN95 -c M.f95
I'll have another look tomorrow, just in case I have multiple M.F95s somewhere in my path.
Eddie |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Thu Sep 18, 2014 11:30 pm Post subject: Re: |
|
|
mike.smartcam wrote: |
I have uploaded the problem files to dropbox with the following link:
|
The code posted to Dropbox contains the declarations of the variables and functions, and that allows us to see why the code is not legal in Fortran. CDIP is not a variable, as the earlier code snippets might have suggested, but is a function that takes two integer arguments and returns a character of adjustable size:
Code: | CHARACTER*(*) FUNCTION CDIP(NUM,NLEN) |
This function is invoked in an expression that is part of the I/O list in a WRITE statement:
Code: | WRITE(4,*)'@WIN /R CUTEDITR '//CDIP(25,L)(:L)//FLE1 |
Some languages such as C++ permit using "anonymous variables", but standard Fortran never did, as far as I know, with one exception: when an expression is used as a subprogram actual argument, many compilers evaluate the expression, assign the resulting value to a temporary variable and pass the address of the temporary variable to the subprogram. |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Fri Sep 19, 2014 12:15 am Post subject: |
|
|
As CDIP is a character function, I replaced:
WRITE(4,*)'@WIN /R CUTEDITJ '//CDIP(25,L)(:L)//FLE1
with
character cdip_result*60
cdip_result = CDIP(25,L)
WRITE(4,*)'@WIN /R CUTEDITJ '//cdip_result(:L)//FLE1
It then linked ok, but I could not run it, as I did not have the initial settings.
It may be a deficiency of FTN95 not to support the function expression "CDIP(25,L)(:L)" in a write statement, but it did report the problem.
Perhaps you could use "trim(CDIP(25,L))" as an alternative.
John |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Sep 19, 2014 9:56 am Post subject: |
|
|
Yes, I found another M somewhere else.
Eddie |
|
Back to top |
|
|
|