 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Nathan
Joined: 26 Oct 2011 Posts: 10
|
Posted: Thu Oct 27, 2011 7:43 am Post subject: Error 409, Field width zero not allowed on input |
|
|
Any ideas what this error means? My calling code where it fails is
read(toprec,'(a)') gifver1
When running the debugger
toprec = '�???????????
gifver1 = 48
character*(mxrecl) toprec
where mxrecl = 512
Any help would be appreciated.
Thanks, |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Oct 27, 2011 8:01 am Post subject: |
|
|
What are you aiming to do?
A WRITE statement would make sense if you wanted to change an integer to a string...
Code: | character*(512) toprec
integer gifver1
gifver1 = 48
write(toprec,'(i4)') gifver1
end |
|
|
Back to top |
|
 |
felix
Joined: 09 Aug 2011 Posts: 5
|
Posted: Mon Oct 31, 2011 12:47 am Post subject: WRITE internal |
|
|
Talking about buffer writing, consider this sample:
! Fortran 95, freebee 6.1, GOT A RUN-TIME BUG!!
! Given the following:
CHARACTER*80 DATA1
CHARACTER*80 DATA2
CHARACTER*168 BUFFER
DATA1 = 'GOOD DATA: 1'
DATA2 = 'GOOD DATA: 2'
BUFFER = 'DIRTY CONTENTS'
! The following does not work as INTENDED!!!!
WRITE (BUFFER, FMT=601) DATA1
601 FORMAT (T001, A80)
WRITE (BUFFER, FMT=602) DATA2
602 FORMAT (T081, A80)
WRITE (BUFFER,603) 'SHOWS UP'
603 FORMAT (T161, A
! Synopsis: Given a bunch of writes to a single
buffer, only the last one above is a keeper.
The previous writes are ignored, in effect,
except for blanking/nulling out the dirties.
Any ERR path, when supplied, is not taken.
The format T indexer should allow over-write
or at least give an ERR condition if not
allowed by decree....Preference is to allow
over-write, but if the BUFFER exceeded, a
run-time ERR must occur if at all reasonable,
coding wise.
! The following works fine.....
WRITE (BUFFER,605) DATA1, DATA2, 'SHOWS UP'
605 FORMAT (A80, A80, A
Sincerly,
FELIX M ROBBINS
2520 SOUTH 22ND STREET
FORT SMITH AR 72901 |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Mon Oct 31, 2011 1:04 am Post subject: |
|
|
There are probably many alternatives, but consider the following:
WRITE (BUFFER(1:80), FMT=601) DATA1
WRITE (BUFFER(81:160), FMT=601) DATA2
WRITE (BUFFER(161:), FMT=601) 'SHOWS UP'
601 FORMAT (A)
This approach limits the part of BUFFER that is set to blank in each write.
Your original example may overwrite the full 168 characters of BUFFER for each write.
John |
|
Back to top |
|
 |
Nathan
Joined: 26 Oct 2011 Posts: 10
|
Posted: Mon Oct 31, 2011 3:24 am Post subject: |
|
|
I am not too sure what the code does. I am not much of a fortran programmer. When I compile with ftn95 using a makefile, it runs fine. When I debug using ftn95 in VS2005, it stops at this stage in the program with this error. As it runs fine (apparently ????) using the makefile, I was hoping to not change much code in debugger mode, as really my aim is to debug a different part of the program. |
|
Back to top |
|
 |
felix
Joined: 09 Aug 2011 Posts: 5
|
Posted: Mon Oct 31, 2011 3:47 am Post subject: |
|
|
Thanks, John. I can see the reasoning after realizing I was missing the format style you have given. Gosh, it's been a long time since my Fortran days for real. My last professional experience has been with the CDC compilers. I have skinned the cat many times using EQUIVALENCE statements to the hilt. ... felix |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|