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

Problem with format

JohnR
Beginner
1,767 Views
Hi

Can anyone see a problem with the following output statement

WRITE( 10 , "(I5,',F',17(',',F12.5))" ) I_Sim , &
SimAvg%Flat%Year , (SimAvg%Flat%Quarter(Quarter) , Quarter=1,4) , &
(SimAvg%Flat%Month(Month),Month=1,12)

This works fine in 11.0.072 but 11.1.038 bitterly complains with

d:\john\Documents\Projects\RSE\src\simulation_engine.f90(657): error #6181: An extra comma appears in the format list. [,,F,]
d:\john\Documents\Projects\RSE\src\simulation_engine.f90(657): error #6181: An extra comma appears in the format list. [,,F]


Also, is there any reason why I can't compile a file by right clicking in the Solution Explorer in VS2008? This was a nice feature in VS2005.

Thanks

John
0 Kudos
10 Replies
jimdempseyatthecove
Honored Contributor III
1,767 Views

John,

This may have nothing to do with it but your format descriptor uses 17(... but you are supplying 16 variables to write. Try changing 17 to 16 and see what happens.

Jim Dempsey
0 Kudos
Les_Neilson
Valued Contributor II
1,767 Views

John,

This may have nothing to do with it but your format descriptor uses 17(... but you are supplying 16 variables to write. Try changing 17 to 16 and see what happens.

Jim Dempsey

No it's ok - 12 months + 4 quarters + 1 year = 17 items (plus the integer)
I put the format into some test code I use and it compiled ok with IVF 10.1.025 -though I didn't use types just plain real arrays.
Ihave VS2008 and right click on my test code gave me a compile option in the popup menu. If you don't see it you could always addthe compile iconto a toolbar (I added it to my Build toolbar ) or use ctrl-F7

so I'm not sure what the cause of the error is (probably a bug in 11.1).

Les
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,767 Views

Les,

Apparently we went to different counting schools

[cpp]WRITE( 10 , "(I5,',F',17(',',F12.5))" ) ...        
[/cpp]

The year is printed using the I5, leaving the 4 quarters and 12 months (16 values)

Jim
0 Kudos
jparsly1
New Contributor I
1,767 Views


In any case providiing "extra" format information should be completely harmless, and is a pretty common thing
to do. Like this case:

write(10,'(31I4)') (IDATA(imonth,J),J=1,ndays(imonth))

where ndays(imonth)could be 28,29,30, or 31


Les,

Apparently we went to different counting schools

[cpp]WRITE( 10 , "(I5,',F',17(',',F12.5))" ) ...        
[/cpp]

The year is printed using the I5, leaving the 4 quarters and 12 months (16 values)

Jim

0 Kudos
Les_Neilson
Valued Contributor II
1,767 Views

Les,

Apparently we went to different counting schools

[cpp]WRITE( 10 , "(I5,',F',17(',',F12.5))" ) ...        
[/cpp]

The year is printed using the I5, leaving the 4 quarters and 12 months (16 values)

Jim

Re: my mental arithmatic. Nothing would suprise me but - What about the I_SIM integer on the same line as the write statement ;-)
Les

my spelling isn't too good eithereven at the second attempt -"arithmatic" ? My mother would shake her head in dismay :-)
0 Kudos
Kevin_D_Intel
Employee
1,767 Views

John, I cannot reproduce this error. Could you perhaps paste a small complete reproducer?
0 Kudos
JohnR
Beginner
1,767 Views

John, I cannot reproduce this error. Could you perhaps paste a small complete reproducer?

Hi Kevin,

If I replace the line with
WRITE( * , "(I5,',F',17(',',F12.5))" ) 3 , (1.0,C1=1,17)
I still get error #6181: An extra comma appears in the format list. [,,F,]

A new project (see below), builds OK and produces the expected output. I will keep digging into this

PROGRAM Main

INTEGER :: C1

WRITE( * , "(I5,',F',17(',',F12.5))" ) 3 , (1.0,C1=1,17)

END PROGRAM Main



Thanks

John
0 Kudos
Lorri_M_Intel
Employee
1,767 Views

John, I cannot reproduce this error. Could you perhaps paste a small complete reproducer?

Any chance you're using the preprocessor on your original source?

- Lorri
0 Kudos
Kevin_D_Intel
Employee
1,767 Views

Sounds like perhaps a project setting is at play since the new project doesn't exhibit the error. Maybe a quick visual comparison of each project's Properties > Fortran > Command Line setting will shed some light.
0 Kudos
Steven_L_Intel1
Employee
1,767 Views
Or maybe you pasted the code from a Word document which changed the quote character?
0 Kudos
Reply