VMS fortran Newbie requires HELP! 
Author Message
 VMS fortran Newbie requires HELP!

All,

I am trying to learn fortran for a one-off project and have come across
a problem that I just don't understand.

Consider the following code: (read.lis is the listing produced with /LIS
qualifier)

        integer*4       stat
        character*256   inrec

        open (unit=1,file='read.lis',status='old', iostat=stat,
     1          organization='sequential', access='sequential',
     2          recordtype='variable', form='unformatted',
     3          readonly)

5       read (unit=1, iostat=stat, end=9000), inrec
c I removed the err=8999 to see what would happen

        print 10, inrec
10      format ('/INREC = ',A)

        goto 5

8999    print *,'An error occurred'
9000    close (unit=1)
9999    end

At run-time, I get ERROR 67 - input statement requires too much data on
the READ statement. Can someone tell me exactly what this error means
and what I am doing wrong (and possibly point me in the right
direction).

I have no physical manuals, just the VMS help and whatever I can get
from Compaqs' web site, so please excuse any stupid mistakes.

VMS 5.5-2 (VAX)
Fortran 6.5

Compiled using:    fortran/noopt/extend

Many thanks,

Adrian Birkett
VMS CofE

===== My own opinion, not that of my employer =====



Wed, 18 Jun 1902 08:00:00 GMT  
 VMS fortran Newbie requires HELP!


Quote:
>At run-time, I get ERROR 67 - input statement requires too much data on
>the READ statement. Can someone tell me exactly what this error means
>and what I am doing wrong (and possibly point me in the right
>direction).

This error means that you executed an unformatted READ statement in
which the total length of the I/O list (length of variables requested
to be read) was longer than the length of the record in the file.  In
your example,  inrec is CHARACTER*256.  If the external record was,
say, 100 characters, you would get this error.

Depending on what you want to accomplish, using formatted input might
work better.  For example:

5       read (unit=1, fmt='(A)',iostat=stat, end=9000), inrec

In this case, if the file record is short, inrec will get padded on
the right with blanks.

By the way, detailed explanations of all the compile-time and run-time
error messages are available by using the command:

$ HELP FORTRAN Error_Messages


Fortran Engineering
Compaq Computer Corporation, Nashua NH

Compaq Fortran web site: http://www.compaq.com/fortran



Wed, 18 Jun 1902 08:00:00 GMT  
 VMS fortran Newbie requires HELP!

Quote:

> All,

> I am trying to learn Fortran for a one-off project and have come across
> a problem that I just don't understand.

> Consider the following code: (read.lis is the listing produced with /LIS
> qualifier)

>         integer*4       stat
>         character*256   inrec

>         open (unit=1,file='read.lis',status='old', iostat=stat,
>      1          organization='sequential', access='sequential',
>      2          recordtype='variable', form='unformatted',
>      3          readonly)

> 5       read (unit=1, iostat=stat, end=9000), inrec
> c I removed the err=8999 to see what would happen

>         print 10, inrec
> 10      format ('/INREC = ',A)

>         goto 5

> 8999    print *,'An error occurred'
> 9000    close (unit=1)
> 9999    end

> At run-time, I get ERROR 67 - input statement requires too much data on
> the READ statement. Can someone tell me exactly what this error means
> and what I am doing wrong (and possibly point me in the right
> direction).

> I have no physical manuals, just the VMS help and whatever I can get
> from Compaqs' web site, so please excuse any stupid mistakes.

> VMS 5.5-2 (VAX)
> Fortran 6.5

> Compiled using:    fortran/noopt/extend

> Many thanks,

> Adrian Birkett
> VMS CofE

> ===== My own opinion, not that of my employer =====

It means that you told the program to read 256 bytes, but the record isn't
that long.  Use DUMP/RECORD to see what the records lengths are.  Use
ANALYZE/RMS to see what organization RMS believes that the file has.  It
also looks to me like the combination of recordtype and form are unusual to
say the least.  I ordinarily think of unformatted files as having a fixed
record length.  As for the error exit at statement 8999, it really doesn't
tell the user anything.

If I were writing this program, I would have written:

 5     read(unit=1, 100, iostat=stat, end=9000) nchar, inrec(1:nchar)
100  format (q, 256a1)

You might get more help from comp.os.vms.

Jim



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. newbie requiring array help

2. Newbie Help required: Deleting double entries in a line ($0)

3. Clipper Newbie Help Required

4. Newbie requiring help.

5. Importing packages and classes help required by newbie

6. Import statement help required by newbie please

7. Need help linking Ada code to Fortran on VAX/VMS

8. Help needed on old VMS Fortran 77 Program

9. Help converting VMS Fortran to C

10. Help with old VMS-Fortran

11. NEED HELP IN VAX/VMS FORTRAN SCREEN INTERFACE

12. help: VMS fortran77 to DOS-fortran

 

 
Powered by phpBB® Forum Software