Mike Smith
unread,Jan 29, 2015, 9:16:00 AM1/29/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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