View previous topic :: View next topic |
Author |
Message |
WDG
Joined: 13 May 2008 Posts: 14
|
Posted: Wed May 14, 2008 6:46 pm Post subject: COMPILE ERROR ? |
|
|
Program MegaMoney
CHARACTER*10 FUNCTION DATE@()
CHARACTER*10 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?) |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Wed May 14, 2008 8:10 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
WDG
Joined: 13 May 2008 Posts: 14
|
Posted: Thu May 15, 2008 2:53 am Post subject: THANK YOU |
|
|
|
|
Back to top |
|
|
|