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
初学者
3,121 次查看
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 项奖励
10 回复数
jimdempseyatthecove
名誉分销商 III
3,121 次查看

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 项奖励
Les_Neilson
重要分销商 II
3,121 次查看

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 项奖励
jimdempseyatthecove
名誉分销商 III
3,121 次查看

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 项奖励
jparsly1
新分销商 I
3,121 次查看


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 项奖励
Les_Neilson
重要分销商 II
3,121 次查看

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 项奖励
Kevin_D_Intel
员工
3,121 次查看

John, I cannot reproduce this error. Could you perhaps paste a small complete reproducer?
0 项奖励
JohnR
初学者
3,121 次查看

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 项奖励
Lorri_M_Intel
员工
3,121 次查看

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 项奖励
Kevin_D_Intel
员工
3,121 次查看

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 项奖励
Steven_L_Intel1
3,121 次查看
Or maybe you pasted the code from a Word document which changed the quote character?
0 项奖励
回复