forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Missing width count error

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
kami_bek



Joined: 06 Oct 2009
Posts: 6
Location: Plymouth, UK

PostPosted: Sat Dec 12, 2009 6:00 pm    Post subject: Missing width count error Reply with quote

Hi guys. Here's a bit of code

open (10,file="minus.dat")
do j=jb,1,-1
do i=1,ib
write(10,fmt='(E,A)', ADVANCE='NO') HB_test(I,J),' '
end do
write(10,*)
end do
close(10)

which is causing this error

D:\PRCE\PRCE507\POM\vmPOM\GRID.F(1722) : error 270 - Missing width count for 'E' descriptor

What does that mean and how can I fix it?

Thank you
Back to top
View user's profile Send private message
Wilfried Linder



Joined: 14 Nov 2007
Posts: 314
Location: Düsseldorf, Germany

PostPosted: Sat Dec 12, 2009 7:41 pm    Post subject: Reply with quote

"E" is the descriptor for exponential numbers and must be used like E20.10 which means 20 digits in total, 10 for the exponent.
"A" is the descriptor for characters. It can be used with (e.g. A40) or without a value for the number of characters (length).

I think that in your case something like 2I10 should be used meaning 2 integer values of each 10 numbers.

Regards, Wilfried
Back to top
View user's profile Send private message
kami_bek



Joined: 06 Oct 2009
Posts: 6
Location: Plymouth, UK

PostPosted: Sat Dec 12, 2009 11:13 pm    Post subject: Reply with quote

Thank you! The next error is "reference to undefined variable, array element or function result". The line highlighted is

DX(I,1)=DX(I,2)

but i thought the following lines are sufficient to "define the variable":

COMMON/OUT40/AZ(KB),ZZ(KB),DZ(KB),DZZ(KB),ALON(IM,JM),ALAT(IM,JM),
1 DX(IM,JM),DY(IM,JM),H(IM,JM),FSM(IM,JM),DUM(IM,JM),
2 DVM(IM,JM),ART(IM,JM),ARU(IM,JM),ARV(IM,JM),COR(IM,JM),

......and so on.

What's causing the problem?

Thank you again
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2816
Location: South Pole, Antarctica

PostPosted: Sun Dec 13, 2009 10:58 pm    Post subject: Reply with quote

I like how novices think...and i always take the notes from them. A 100 such novices with their questions and suggestions and FTN95 will be a king of perfection (same i believe would improve for example Linux adoption rate by an order of magnitude, from below 1% to tens of %).

You are right, these variables are defined in our common sense. "Undefined" here means that the variable was not assigned any value before its use during program execution. Undefined variable check is most powerful debugging feature of FTN77/95

And i'd say your intuition also drives you in right direction in the format question too at the beginning of this thread. I'd suggest if format E is not specified in detail in WRITE statement ( like xxE.yy ) then some kind of standard output has to be used like it is done in WRITE(*,*).

Any pitfalls here?

P.S.Dec 18 2009. In confirmation of my point i show here some code i found and used today to calculate the day of week based on specified daydate/month/year written by someone many years ago which has output format just 4I. I suppose these are good old VAX extensions. VAX Fortran is forgotten, but it was very popular years ago among scientists and engineers, so its extensions are included in many modern Fortran compilers, while FTN95 is a bit lagging here, some extensions are still missing. I understand that this allow it to be more strict and find more errors (this is one pitfall i see), but people are dumb in seeking the freedom of expression at any cost Smile
Code:
        PROGRAM TEST
        INTEGER DATE, MONTH, YEAR, DOW, DAY

        YEAR = 2009
        DO 10 MONTH = 1, 12, 1
        DO 10 DATE = 1, 31, 1
        DAY = DOW(DATE, MONTH, YEAR)
        WRITE(5,20)MONTH, DATE, YEAR, DAY
10      CONTINUE
20      FORMAT(1X, 4I)
        STOP
        END
C
C       DOW COMPUTES THE DAY OF THE WEEK BASED UPON THE GIVEN DATE,
C       MONTH AND YEAR.  IT USES THE ZELLER CONGRUENCE ALGORITHIM.
C       DATE IS THE DAY OF THE MONTH, 1 - 31
C       MONTH IS THE MONTH OF THE YEAR, 1 - 12
C       YEAR IS THE YEAR, E.G., 1989
C       IT RETURNS 0 FOR SUNDAY, 1 FOR MONDAY, ETC.
C
        INTEGER FUNCTION DOW(DATE, MONTH, YEAR)
        INTEGER DATE, MONTH, YEAR
        INTEGER DAY, YR, MN

        YR = YEAR
        MN = MONTH
C
C       IF JANUARY OR FEBRUARY, ADJUST MONTH AND YEAR
C
        IF (MN.GT.2)GO TO 10
        MN = MN + 12
        YR = YR - 1
10      N1 = (26 * (MN + 1)) / 10
        N2 = (125 * YR) / 100
        DAY = (DATE + N1 + N2 - (YR / 100) + (YR / 400) - 1)
        DOW = MOD(DAY, 7)
        RETURN
        END
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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