Re: reading more data than the record size (RECL)




Are you sure which read is causing the problem? I'd put a
PRINT statement before and after the reads.

*** Hendrickson

ssheriff wrote:
On Apr 11, 4:36 pm, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:


(snip)..

To say anymore, more of the program, especially the WRITE
statement and any declarations for variables being written,
will be needed.

-- glen

OK - here's the write statement, and the subroutine where array is
dimensioned. Basically, it writes an array as one vector.

call read_write(1, 13, id, ny, nx, y0, dy, x0, dx, h)
***
subroutine read_write(mode, lun, id, ncol, nrow, col1, delcol,
&row1, delrow, array)
dimension array(1), work(1000)
character id*56
c.......................................................................
c This subroutine reads a standard file into a one-dimensional
array
c Inputs are mode (0 for read, 1 for write) and lun (logical unit
numbe
cr).
cOutputs are id,ncol,nrow,col1,delcol,row1,delrow, and array.
c.......................................................................
character pgm*8
if (mode .eq. 1) goto 5

Are you sure the next line fits into 72 columns? It's hard to tell
because my newsreader inserts a line break after "row1,". But, if your
version goes into column 73, then the last variable read will be
"delro", not "delrow". Adding IMPLICIT NONE (and declaring
all variables) iften catches things like that.

read(unit=lun) id, pgm, ncol, nrow, nz, col1, delcol, row1,
delrow

PRINT *, 'first read finished', id,pgm,....delrow

Then you'll know what you've got.
goto 6
5 nz = 1
pgm = 'sds-PFMAG3D '
It's odd to declare pgm as an 8 character thing and then assign
12 characters to it. Not wrong, just odd ;). Have you checked
all of the declarations in the calling program to make sure
something isn't declared double precision in one place and
single in the other?

write(unit=lun) id, pgm, ncol, nrow, nz, col1, delcol, row1,
&delrow
c
6 continue
do 1 j = 1, nrow
l = 0
i1 = ((j - 1) * ncol) + 1
i2 = (i1 + ncol) - 1
if (mode .eq. 1) goto 3
print *, 'going into row_read',J, NCOL

call row_read(lun, work, ncol)
print *, 'pack from row_read'

do 2 i = i1, i2
l = l + 1
2 array(i) = work(l)
goto 1
3 continue
do 4 i = i1, i2
l = l + 1
4 work(l) = array(i)
call row_write(lun, work, ncol)
1 continue
return
end
subroutine row_read(lun, work, ncol)
dimension work(ncol)
read(unit=lun) dummy, work
return
end
subroutine row_write(lun, work, ncol)
dimension work(ncol)
dummy = 999.
write(unit=lun) dummy, work
return
end
.