Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

What am I doing wrong here?

Les_Neilson
Valued Contributor II
175 Views
With the sample code below
Code:
PROGRAM TestL

         integer :: outlu
         outlu = 12
         open (outlu,file='test.dxf', status='new',form='formatted')


         write(outlu,91000) 0,' LINE'
         write(outlu,91000) 8,' SOLID1B'
         write(outlu,91000) 6,' CONTINUOUS'
         write(outlu,91000) 62,' 2'


91000    format (i3,/,a)
91001    format (i2,/,f15.3)


         stop
END PROGRAM


I get the following compile errors :

jetto.f90(8) : Error: Syntax error, found IDENTIFIER 'WRITE' when expecting one of: .EQV. .NEQV. .XOR. .OR. .AND. .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...

jetto.f90(8) : Error: Syntax error, found INTEGER_CONSTANT '8' when expecting one of: .EQV. .NEQV. .XOR. .OR. .AND. .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...

jetto.f90(10) : Error: Syntax error, found FORMAT_INTEGER '91001' when expecting one of: ;

It may be Ihave nothad enough coffee, but I can't see what I am doing wrong!

Les

PS

If I change thewrite statementsto :

write(outlu,91000) (0,' LINE')
write(outlu,91000) (8,' SOLID1B')
write(outlu,91000) (6,' CONTINUOUS')
write(outlu,91000) (62,' 2')

then I get the following compile error message :

jetto.f90(8) : Error: Syntax error, found FORMAT_INTEGER '91001' when expecting one of: ;

Which implies a problem with the two format statements? (Note the use of the "/" edit descriptor to output a new line between the two items in the i/o list.

Les

Message Edited by Les_Neilson on 05-15-200604:12 AM

0 Kudos
10 Replies
Les_Neilson
Valued Contributor II
175 Views

If I comment out the second format it compiles ok with or without the ( ) around the i/o list.

(I am trying to debuga geometry problem andam trying to write out that part of the model dataas a dxf file which I can view in a dxf viewer.)

Les

anthonyrichards
New Contributor III
175 Views
The unmodified code compiled OK for me using Compaq Visual Fortran 6.6C. When run, the program's output looked like:
Code:
 0
 LINE
  8
 SOLID1B
  6
 CONTINUOUS
 62
 2

Maybe you have some extra characters somewhere that are not listed. For example if I add an '&' thus:

write(outlu,91000) 0,' LINE' &
write(outlu,91000) 8,' SOLID1B'
and try recompiling I get the following messages:
Code:
C:F90DFformatformat.f90(32) : Error: Syntax error, found IDENTIFIER 'WRITE' when expecting one of: ( * :: ,  ; : ) + . - (/ [ ] /) ' ** / > // ...
         write(outlu,91000) 8,' SOLID1B'
---------^
C:F90DFformatformat.f90(32) : Error: Syntax error, found INTEGER_CONSTANT '8' when expecting one of: ( * :: ,  ; : ) + . - % (/ [ ] /) . ' ** / > ...
         write(outlu,91000) 8,' SOLID1B'
-


Message Edited by anthonyrichards on 05-15-200605:09 AM

Steven_L_Intel1
Employee
175 Views
If I copy and paste the source from your post, I get no errors compiling with ifort 9.1. How about attaching a ZIP of the source to a reply? I suggest a zip as that will ensure that we see the exact bits.
Les_Neilson
Valued Contributor II
175 Views

Thank you Steve.

I opened the source file in vi and immediately saw that the write and format statements were each one long line.There were control-M's but no line feed. It looked ok in the IDE editor.

As soon as I corrected the line feeds it compiled correctly.

I like vi :-)

Les

jim_dempsey
Beginner
175 Views

Les,

Looks like you are importing source code from a Mac (which uses Return without LineFeed). A friend of mine uses Mac and I use Windoz. So I use a set of edit macros to clean up the source code whenever I receive files.

Other areas your may have problems with are the continuation lines in DATA blocks. Just something of a heads up.

Jim Dempsey

Steven_L_Intel1
Employee
175 Views
Well, the Windows compiler (and Visual Studio) will accept sources that have UNIX-style line terminators. It may be that if there's a mix of the terminators that it may not work.
jimdempseyatthecove
Black Belt
175 Views
Steve,
All I know is IVF balked at compiling the files off a Mac until after I replaced the CR (or was it LF) with CRLF. It may be qite possible that there is a compiler option (cleverly hidden) that would have corrected this. I didn't find that option. Probably a case of the documentor assuming "everybody knows this" or "it says so right here". In any event I did not find the information in the documentation.Making the CRLF edits worked. I also had to fix up some of the continuation lines and DATA initialization statements. This may have been more of a F77 to F90/F95 issue.
Jim
Steven_L_Intel1
Employee
175 Views
There's no option. I know it compiles UNIX files, I'd expect Mac files to be similar.
jd_weeks
Beginner
175 Views
The Macintosh standard line-end character is a CR. But now that OS X is based on Unix, it's quite possible to get files with LF line-endings. The popular Mac text editor BBEdit can save a file either way, and convert from one to another. (In fact, it can handle CRLF files, too.)
Les_Neilson
Valued Contributor II
175 Views

Just for information :

We are all on XP with Visual Studio IDEhere.

I happen to have cygwin with vi installed as a personal preference. (My previous job started out using unix, migrated to windows and I took vi with me!)

I amat the momentworking on two versions of our code (current and next release) For current (bugfixing)I generally work in the IDE for quicker build-debug cycle, and for next releaseI usevi for quicker code writing (and the ide for thebuild).I had been doing a lot of cut and paste between themall and somewhere along the way "lost" the LF on some lines. By that time I was in the IDE building various solutions. The files "looked" ok in the IDE, and I didn't think to check them in vi until Steve mentioned sending a zip file where he could examine the binary/hex values. And voila I saw the error of my ways.

Les

Reply