Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem on format

Status
Not open for further replies.

kom4tsu

Programmer
Aug 4, 2014
5
BR
Hi everyone,

I'm new here, so if I'm doing something wrong just tell me.
I have a problem with a format in my program.

This is the format:
995 format(5x,10herro:vi=,i12,7h,10x,7hihist=,i8)


The error says this:
995 format(5x,10herro:vi=,i12,7h,10x,7hihist=,i8)
1
Error: Unexpected element ',' in format string at (1)


If anyone can help me, I'd be very greatful.

Thank you,

Kom4tsu
 
Where exactly under the "i12,7h"? Next time, use CODE tags, please.

I am thinking the comma came too soon as you said your Hollerith constant was going to be 10 characters long (10h)...not that Hollerith constants cannot take commas, but you took it away from the i12 format.

Or, 7h is not quite accepted either? Maybe just use "7x" ?

But all this is besides the point, please stop using Hollerith constants; instead, use regular string constants:

Code:
995 format(5x,"erro:vi= ",i12,7x,10x,"ihist= ",i8)
 
Should really use ' instead of ". " didn't become standard until F90. If Hollerith constants exist, then it is probably F77.

The part that doesn't make sense is the 7x,10x - why not just 17x? I'm guessing that it was copied without spaces. Could it mean
Code:
995   format(5x, 'erro:vi= ', i12,',',10x,'ihist=',i8)
 
That's fine, use single quotes, then. As far as the 7x followed by 10x...that was just me not wanting to merge a couple of format fields (7h,10x) the OP had in the first place...the less I change things, the better the OP can go from his code to the proposed one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top