Silverfrost Forums

Welcome to our forums

Missing width count error

12 Dec 2009 5:00 #5528

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

12 Dec 2009 6:41 #5529

'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

12 Dec 2009 10:13 #5531

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

13 Dec 2009 9:58 #5537

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 😃

        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
Please login to reply.