 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
reinoud
Joined: 11 May 2010 Posts: 2 Location: Holland
|
Posted: Tue May 11, 2010 10:56 pm Post subject: error 57: attempt to read past end-of-file |
|
|
Hello,
I encounter the error: ERROR 57: attempt to read past end-of-file. It occures during the call:
CALL RDDUMP(....
[see the first part of the program here under] The file DUMP is created in the first run of the program and runs well. As somebody a solution?
Regards Reinoud
C******************************************************************************
PROGRAM EXMPLR
C
C*******************************************************************************
C Restart of EXMPL, default values, Jacobian derivatives exact ***
C*******************************************************************************
INTEGER MXLEV, NPD, NPTS, LENIWK, LENRWK, LENLWK
PARAMETER (MXLEV=2, NPD=2, NPTS=2500)
PARAMETER (LENIWK=NPTS*(5*MXLEV+14),
+ LENRWK=NPTS*NPD*(5*MXLEV + 9+18*NPD),
+ LENLWK=2*NPTS)
C
INTEGER LUNDMP
PARAMETER (LUNDMP = 89)
C
INTEGER NPDE, INFO(1), IWK(LENIWK), MNTR
LOGICAL LWK(LENLWK)
DOUBLE PRECISION T, TOUT, DT, XL, YL, XR, YU, DX, DY,
+ TOLS, TOLT, RINFO(1), RWK(LENRWK)
C******************************************************************************
C*** Continuation call of VLUGR2 ***
C******************************************************************************
MNTR = 1
TOUT = 3.0
TOLS = 0.1
TOLT = 0.05
C******************************************************************************
C*** OPEN FILE FOR OUTPUT ***
C
OPEN(UNIT=7,STATUS="old",FILE='C:/documents/exmplr.tbl')
C
C******************************************************************************
C Default choices
INFO(1)=0
C*******************************************************************************
C READ VALUES DUMP from first run ****
C*******************************************************************************
OPEN(UNIT=LUNDMP,FILE='DUMP',FORM='UNFORMATTED')
CALL RDDUMP (LUNDMP, RWK, LENRWK, IWK, LENIWK)
CLOSE(LUNDMP)
C***********************************************************
C***********************************************************
C call main routine
CALL VLUGR2 (NPDE, T, TOUT, DT, XL, YL, XR, YU, DX, DY,
+ TOLS, TOLT, INFO, RINFO, RWK, LENRWK, IWK, LENIWK, LWK, LENLWK,
+ MNTR)
PRINT *, 'VLUGR2 returned with MNTR=', MNTR
C
OPEN(UNIT=LUNDMP,FILE='DUMP2',FORM='UNFORMATTED')
CALL DUMP (LUNDMP, RWK, IWK)
CLOSE(LUNDMP)
END
C******************************************************************************
C*** ***
C*** SUBR DERIVF ***
C*** ***
C******************************************************************************
c |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed May 12, 2010 7:07 am Post subject: |
|
|
It seems like you try to perform some read action in your subroutine RDDUMP (which you did not provide). You could try the following: Errors corresponding to input statements (like read) can be trapped using ERR= and/or IOSTAT= in the file OPEN command. This might help you to find the line in your RDDUMP subroutine which causes the problem.
IOSTAT=<variable>
<variable> is an integer numeric variable into which the input/output status will be written. The variable will be positive if an error occurred, otherwise it will be zero.
ERR=<label>
<label> is a label to jump to in the event of an error. |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Wed May 12, 2010 12:08 pm Post subject: |
|
|
Or even
|
|
Back to top |
|
 |
reinoud
Joined: 11 May 2010 Posts: 2 Location: Holland
|
Posted: Wed May 12, 2010 8:51 pm Post subject: error 57: attempt to read past end-of-file |
|
|
Hello jjgermis,
Thanks for your reply. I send you the DUMP and RGDUMP files They are part of the huge main file VLUGR2. It has to to with the lenght of the file.:
SUBROUTINE DUMP (LUNDMP, RWK, IWK)
C
C-----------------------------------------------------------------------
C
Ccc PARAMETER SPECIFICATION:
INTEGER LUNDMP, IWK(*)
DOUBLE PRECISION RWK(*)
C
Ccc PURPOSE:
C Dump all information necessary for a restart of VLUGR2 on file
C
Ccc PARAMETER DESCRIPTION:
C LUNDMP : IN. Logical unit number of dumpfile. Should be opened as an
C unformatted file.
C RWK : IN. Real workstorage as returned from VLUGR2
C IWK : IN. Integer workstorage as returned from VLUGR2
C
Ccc EXTERNALS USED: NONE
C
C
Ccc INCLUDE 'CMNSTATS'
C
C CMNSTATS
C
C COMMON with integration statistics
INTEGER MXCLEV, MXCNIT
PARAMETER (MXCLEV = 10, MXCNIT = 20)
INTEGER LUNPDS, LUNNLS, LUNLSS, LEVEL, NSTEPS, NREJS,
+ NJACS(MXCLEV), NRESID(MXCLEV), NNIT(MXCLEV),
+ NLSIT(MXCLEV,MXCNIT)
COMMON /STATS/ LUNPDS, LUNNLS, LUNLSS, LEVEL, NSTEPS, NREJS,
+ NJACS, NRESID, NNIT, NLSIT
SAVE /STATS/
C
C end INCLUDE 'CMNSTATS'
C
C
Ccc INCLUDE 'CMNWRITEF'
C
C CMNWRITEF
C
C COMMON needed for continuation calls
INTEGER MAXLVW, NPDEW, LRWKPS, LIWKPS, LRWKB, LIWKB
LOGICAL FIRST, SECOND
DOUBLE PRECISION T0, TW, TEW, DTW, XLW, YLW, XRW, YUW, DXB, DYB,
+ DTO
COMMON /WRITIF/ MAXLVW, NPDEW, LRWKPS, LIWKPS, LRWKB, LIWKB
COMMON /WRITLF/ FIRST, SECOND
COMMON /WRITRF/ T0, TW, TEW, DTW, XLW,YLW, XRW,YUW, DXB, DYB, DTO
SAVE /WRITIF/, /WRITLF/, /WRITRF/
C
C end INCLUDE 'CMNWRITEF'
C
C
C-----------------------------------------------------------------------
C
INTEGER I, J
WRITE(LUNDMP) MAXLVW, NPDEW, LRWKPS, LIWKPS, LRWKB, LIWKB,
+ FIRST, SECOND,
+ T0, TW, TEW, DTW, XLW, YLW, XRW, YUW, DXB, DYB, DTO
WRITE(LUNDMP) LUNPDS, LUNNLS, LUNLSS, LEVEL, NSTEPS, NREJS,
+ (NJACS(I), I=1,MXCLEV), (NRESID(I), I=1,MXCLEV),
+ (NNIT(I), I=1,MXCLEV), ((NLSIT(I,J), I=1,MXCLEV), J=1,MXCNIT)
WRITE(LUNDMP) (RWK(I), I=1,LRWKPS+LRWKB)
WRITE(LUNDMP) (IWK(I), I=1,LIWKPS+LIWKB)
RETURN
END
SUBROUTINE RDDUMP (LUNDMP, RWK, LENRWK, IWK, LENIWK)
C
C-----------------------------------------------------------------------
C
Ccc PARAMETER SPECIFICATION:
INTEGER LENIWK
INTEGER LUNDMP, LENRWK, IWK(LENIWK)
DOUBLE PRECISION RWK(LENRWK)
C
Ccc PURPOSE:
C Read all information necessary for a restart of VLUGR2 from file
C
Ccc PARAMETER DESCRIPTION:
C LUNDMP : IN. Logical unit number of dumpfile. Should be opened as an
C unformatted file.
C RWK : OUT. Real workstorage intended to pass to VLUGR2
C LENRWK : IN. Dimension of RWK.
C IWK : OUT. Integer workstorage intended to pass to VLUGR2
C LENIWK : IN. Dimension of IWK.
C
Ccc EXTERNALS USED: NONE
C
C
Ccc INCLUDE 'CMNSTATS'
C
C CMNSTATS
C
C COMMON with integration statistics
INTEGER MXCLEV, MXCNIT
PARAMETER (MXCLEV = 10, MXCNIT = 20)
INTEGER LUNPDS, LUNNLS, LUNLSS, LEVEL, NSTEPS, NREJS,
+ NJACS(MXCLEV), NRESID(MXCLEV), NNIT(MXCLEV),
+ NLSIT(MXCLEV,MXCNIT)
COMMON /STATS/ LUNPDS, LUNNLS, LUNLSS, LEVEL, NSTEPS, NREJS,
+ NJACS, NRESID, NNIT, NLSIT
SAVE /STATS/
C
C end INCLUDE 'CMNSTATS'
C
C
Ccc INCLUDE 'CMNWRITEF'
C
C CMNWRITEF
C
C COMMON needed for continuation calls
INTEGER MAXLVW, NPDEW, LRWKPS, LIWKPS, LRWKB, LIWKB
LOGICAL FIRST, SECOND
DOUBLE PRECISION T0, TW, TEW, DTW, XLW, YLW, XRW, YUW, DXB, DYB,
+ DTO
COMMON /WRITIF/ MAXLVW, NPDEW, LRWKPS, LIWKPS, LRWKB, LIWKB
COMMON /WRITLF/ FIRST, SECOND
COMMON /WRITRF/ T0, TW, TEW, DTW, XLW,YLW, XRW,YUW, DXB, DYB, DTO
SAVE /WRITIF/, /WRITLF/, /WRITRF/
C
C end INCLUDE 'CMNWRITEF'
C
C
C-----------------------------------------------------------------------
C
INTEGER I, J
|
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Fri May 14, 2010 2:05 am Post subject: |
|
|
Your error message " encounter the error: ERROR 57: attempt to read past end-of-file." would give a line number if you compiled including /debug.
As Ian has suggested, at the offending line, use an END= or IOSTAT= and interogate the offending file unit "IF (IOSTAT /= 0) ...", such as
INQUIRE (UNIT=LUNDMP, NAME=<char_variable>, ...) Look at the "INQUIRE - file or unit" in help for ideas
Print out the file unit number and the file name, then check the file size, using windows explorer or dos DIR.
The answer could be that you are looking for too much information, or more likely, that the file is empy; due to wrong file name or the file has been overwritten (check OPEN statement).
John |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Fri May 14, 2010 8:54 am Post subject: |
|
|
Try incrementing a variable such as "no_of_lines" just before or after the read statement. At the labels that the end= or err= sends you to, print out the number of the line you were trying to read or the last one successfully read. At least you will know which line you were reading.
Ian |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Mon May 17, 2010 8:57 am Post subject: |
|
|
Hi Reinoud,
unfortunately you cannot post large portions of your code in the forum. My suggestion to you is to make a very simple (and small) working example of your code. If you look at your RDDUMP code in the forum you will notice that the READ intruction (where you have problems) does not appear. Ian and John gave a good summary of what could go wrong as well as some good advice to trap the error message.
Good luck! |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|