Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

READ using DIRECT ACCESS problem

7 views
Skip to first unread message

Mike Smith

unread,
Jan 29, 2015, 9:16:00 AM1/29/15
to
Hi Group,

I am having problems with the following code, it is creating the run time
error *ERR* IO-09 in the command window, I have indicated in the code were
the problem occurs by using a PAUSE statement.

I have also included a segment from the file 'TEMPFILE.REO' which the
routine is trying to sequence.


Code:

* FILE: REORDER.FOR
* flip the order of the records
********************************************************************
SUBROUTINE REORDER(FLE,L,RLEN,UN1,UN2)
IMPLICIT NONE
INTEGER NUM_REC,L,UN1,UN2,I1,RLEN
CHARACTER *(*) FLE
CHARACTER *80 LN1

PRINT*,'**** START SUBROUTINE REORDER ****'
OPEN(UN1,FILE=FLE(:L))
NUM_REC = 0
OPEN(UN2,FILE='TEMPFILE.REO')

LOOP
READ(UN1,'(A)',END=100)LN1(:RLEN)
WRITE(UN2,*)LN1(:RLEN)
NUM_REC = NUM_REC + 1
ENDLOOP
100 CLOSE(UN1)
CLOSE(UN2)
* PRINT*,'NUM_REC=',NUM_REC

OPEN(UN1,FILE='TEMPFILE.REO',FORM='FORMATTED',
& ACCESS='DIRECT',RECL=RLEN)
OPEN(UN2,FILE=FLE(:L))
DO I1 = NUM_REC,1,-1

PAUSE'*** OK TO HERE NEXT LINE CAUSING PROBLEM ***'

READ(UN1,'(A)',REC=I1)LN1(:RLEN)
WRITE(UN2,*)LN1(:RLEN)
ENDDO
CLOSE(UN1)
CLOSE(UN2)

PRINT*,'**** END SUBROUTINE REORDER ****'

RETURN
END
********************************************************************

'TEMPFILE.REO' data file

02 9.115385 0.620079 9.115385
02 9.461538 0.620079 9.461538
02 9.807692 0.620079 9.807692
02 10.153846 0.620079 10.153846

Any assistance would be appreciated


Thanks Mike

Frank Beythien

unread,
Jan 29, 2015, 1:37:59 PM1/29/15
to
Am 29.01.2015 um 15:15 schrieb Mike Smith:
> Hi Group,
>
> I am having problems with the following code, it is creating the run
> time error *ERR* IO-09 in the command window, I have indicated in the

From the fortran users guide (fpguide.pdf)

IO-09 system file error - %s1
A system error has occurred while attempting to access a file. The I/O
system error message is displayed.

You don't show the second part of the message.
And don't say whether it happens at the first read or later...


Mike Smith

unread,
Jan 31, 2015, 7:37:55 AM1/31/15
to
Hi Frank,

Thank you for your reply I have attached more detail below:

The code is running in a DOS command window on a Windows 7 o/s 64bit
hardware.

The error code displayed can be seen in the attached jpg file.

The error is generated on the first execution of the code:

READ(UN1,'(A)',REC=I1)LN1(:RLEN)

The program was written many years ago designed to run on a DOS system, I am
trying to port the software to Windows.





Regards,

Mike Smith


"Frank Beythien" wrote in message news:madum5$u3n$1...@www.openwatcom.org...

dpb

unread,
Feb 4, 2015, 3:34:51 PM2/4/15
to
On 01/31/2015 6:37 AM, Mike Smith wrote:

...Please do NOT toppost--hard conversation follow makes...


> The error code displayed can be seen in the attached jpg file.

usenet is text-only...paste the error message in context

> The error is generated on the first execution of the code:
>
> READ(UN1,'(A)',REC=I1)LN1(:RLEN)
>
> The program was written many years ago designed to run on a DOS system,
> I am trying to port the software to Windows.

....

What did the debugging line indicate for NUM_REC?

--

Mike Smith

unread,
Feb 6, 2015, 9:30:41 AM2/6/15
to
I may have resolved the problem, it appears that the data file which this
routine is designed to read had not been completed and therefore not valid.

Thanks to all for there assistance.

"dpb" wrote in message news:matvpa$6qf$1...@www.openwatcom.org...

dpb

unread,
Feb 8, 2015, 10:39:18 AM2/8/15
to
On 02/06/2015 8:30 AM, Mike Smith wrote:
> I may have resolved the problem, it appears that the data file which
> this routine is designed to read had not been completed and therefore
> not valid.
...

Something like that was my conjecture--the code was straightforward.

--

0 new messages