Home > Archive > Fortran > August 2005 > Fortran on VMS
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Volker Englisch 2005-08-16, 4:01 am |
| Hi,
first of all, I have to admit that I'm new to Fortran programming, but
it's not homework I need some advice for :-)
On OpenVMS Alpha, this short example program works perfectly:
PROGRAM T1
IMPLICIT NONE
CHARACTER*1 ANSWER
PRINT *, 'Enter A or B'
READ *, ANSWER
PRINT *, 'Your answer was ', ANSWER
END
On OpenVMS VAX it compiles and links as well, but when run it fails after
the answer is entered:
%FOR-F-LISIO_SYN, list-directed I/O syntax error
unit -4 file SYS$INPUT:.;
user PC 0000063E
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name routine name line rel PC abs PC
0002B092 0002B092
0002AF8F 0002AF8F
00026FFC 00026FFC
T1 T1 4 0000003E 0000062E
Is there something obviously wrong with that READ statement - but only on
VAX, not on Alpha?
TIA
Volker
| |
| Ian Bush 2005-08-16, 5:06 pm |
|
Hi Volker,
Volker Englisch wrote:
> Hi,
>
> first of all, I have to admit that I'm new to Fortran programming, but
> it's not homework I need some advice for :-)
>
> On OpenVMS Alpha, this short example program works perfectly:
>
> PROGRAM T1
> IMPLICIT NONE
> CHARACTER*1 ANSWER
> PRINT *, 'Enter A or B'
> READ *, ANSWER
> PRINT *, 'Your answer was ', ANSWER
> END
>
> On OpenVMS VAX it compiles and links as well, but when run it fails after
> the answer is entered:
>
> %FOR-F-LISIO_SYN, list-directed I/O syntax error
> unit -4 file SYS$INPUT:.;
> user PC 0000063E
> %TRACE-F-TRACEBACK, symbolic stack dump follows
> module name routine name line rel PC abs PC
> 0002B092 0002B092
> 0002AF8F 0002AF8F
> 00026FFC 00026FFC
> T1 T1 4 0000003E 0000062E
>
> Is there something obviously wrong with that READ statement - but only on
> VAX, not on Alpha?
>
Try one of the following, either should work
1) With the above program enter your character as 'A' or 'B', i.e. quotes
about it
2) Modify the read statement to
Read( *, '( a )' ) answer
Basically for a free format read of a character ( which the above is )
you should put quotes around the input. At least with f77 that was, it
may have changed in latter versions, but because I've been burnt by
this I always put an explicit format in,
Ian
| |
| Volker Englisch 2005-08-16, 5:06 pm |
| Hi Ian,
On Tue, 16 Aug 2005, Ian Bush wrote:
> Volker Englisch wrote:
>
>
> Try one of the following, either should work
>
> 1) With the above program enter your character as 'A' or 'B', i.e. quotes
> about it
>
> 2) Modify the read statement to
>
> Read( *, '( a )' ) answer
>
> Basically for a free format read of a character ( which the above is )
> you should put quotes around the input. At least with f77 that was, it
> may have changed in latter versions, but because I've been burnt by
> this I always put an explicit format in,
Thanks a lot, it works great this way.
Volker
| |
| Steve Lionel 2005-08-16, 5:06 pm |
| On Tue, 16 Aug 2005 14:05:32 +0200, Volker Englisch
<eh41@solaris.polarhome.com> wrote:
>
>Thanks a lot, it works great this way.
VAX Fortran is a Fortran 77 compiler. While it does support many extensions
to F77, the ability to read character sequences in list-directed input without
delimiters is not one of them. The Fortran on OpenVMS Alpha is a Fortran 95
compiler which does support this feature.
Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
|
|
|
|
|