Silverfrost Forums

Welcome to our forums

COMPILE ERROR ?

14 May 2008 5:46 #3191

Program MegaMoney CHARACTER10 FUNCTION DATE@() CHARACTER10 DRAW_DATE

  DRAW_DATE = DATE@()
  PRINT *,'PROGRAM RUN ON',DRAW-DATE 

  Stop
  END PROGRAM MegaMoney

What is wrong with this SYNTAX?

C:\Projects\MegaMoney.FOR(2) : error 28 - CHARACTER cannot be declared inside PROGRAM block (perhaps missing CONTAINS or END statement?)

14 May 2008 7:10 #3193

Remove ther word 'FUNCTION'

It is shown in the help as

CHARACTER*10 FUNCTION DATE@()

as that is effectively the first line of the function - it tells you it is a function and returns a character result rather than a subroutine, but you must not define it that way in your program. You just need to define it as

CHARACTER*10 DATE@

You have also used an underscore in the definition of DRAW_DATE, but when you print it, you have put a hyphen, the result would be DRAW minus DATE, where DRAW and DATE are two real numbers, possibly initialised to zero if you used /zeroise in the compile command, and therefore it will print PROGRAM RUN ON 0.000000000

Regards

Ian

15 May 2008 1:53 #3195

😄

Please login to reply.