Silverfrost Forums

Welcome to our forums

Compiler error msg

17 Sep 2014 10:55 #14652

Hi Group,

I am getting a compiler error msg which reads:

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:

                   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?

17 Sep 2014 11:33 #14653

It works OK for me. Here is my test...

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
17 Sep 2014 12:12 #14654

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

17 Sep 2014 12:26 #14655

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

18 Sep 2014 12:46 #14662

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

18 Sep 2014 12:55 #14663

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?

18 Sep 2014 1:20 #14664

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.

18 Sep 2014 4:47 #14665

I have had a quick look at your code and initial problems are

  1. DIP is used as both the name of a common block and the name of a variable

  2. 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.

18 Sep 2014 6:20 #14667

Compiled with v6.35 though!

Eddie

18 Sep 2014 7:55 #14669

I get the same error reports with v6.35.

18 Sep 2014 8:21 #14670

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

18 Sep 2014 10:30 #14671

Quoted from mike.smartcam

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:

CHARACTER*(*) FUNCTION CDIP(NUM,NLEN)

This function is invoked in an expression that is part of the I/O list in a WRITE statement:

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.

18 Sep 2014 11:15 #14672

As CDIP is a character function, I replaced: WRITE(4,*)'@WIN /R CUTEDITJ '//CDIP(25,L)(:L)//FLE1

with character cdip_result60 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

19 Sep 2014 8:56 #14675

Yes, I found another M somewhere else.

Eddie

Please login to reply.