Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- c-------------- Converting direct access files to .txt files ----------------
- SUBROUTINE dat_to_txt
- COMMON /size/ N1, ial
- PARAMETER(Nmax=999)
- DIMENSION ia(Nmax+1), di(Nmax), al(Nmax*Nmax), vec(Nmax)
- OPEN (1, FILE='ia.txt', ERR=1)
- OPEN (2, FILE='di.txt', ERR=1)
- OPEN (3, FILE='al.txt', ERR=1)
- OPEN (4, FILE='vec.txt', ERR=1)
- OPEN (5, FILE='ia.dat', ACCESS='DIRECT', RECL=4, ERR=2)
- OPEN (6, FILE='di.dat', ACCESS='DIRECT', RECL=4, ERR=2)
- OPEN (7, FILE='al.dat', ACCESS='DIRECT', RECL=4, ERR=2)
- OPEN (8, FILE='vec.dat', ACCESS='DIRECT', RECL=4, ERR=2)
- DO i=1, N1+1
- READ (5, REC = i) ia(i)
- WRITE (1, *) ia(i)
- ENDDO
- ial = ia(N1+1)-1
- DO i=1, N1
- READ (6, REC = i) di(i)
- WRITE (2, *) di(i)
- ENDDO
- DO i=1, ial
- READ (7, REC = i) al(i)
- WRITE (3, *) al(i)
- ENDDO
- DO i=1, N1
- READ (8, REC = i) vec(i)
- WRITE (4, *) vec(i)
- ENDDO
- CLOSE(1)
- CLOSE(2)
- CLOSE(3)
- CLOSE(4)
- CLOSE(5)
- CLOSE(6)
- CLOSE(7)
- CLOSE(8)
- GOTO 3
- 1 STOP 'Input error: check the input files.'
- 2 STOP 'Output error: failed to create direct access file.'
- 3 END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement