Advertisement
EgorYankovsky

Untitled

Apr 4th, 2022
1,212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c-------------- Converting direct access files to .txt files ----------------
  2.  
  3.       SUBROUTINE dat_to_txt
  4.       COMMON /size/ N1, ial
  5.       PARAMETER(Nmax=999)
  6.       DIMENSION ia(Nmax+1), di(Nmax), al(Nmax*Nmax), vec(Nmax)
  7.  
  8.       OPEN (1, FILE='ia.txt',  ERR=1)
  9.       OPEN (2, FILE='di.txt',  ERR=1)
  10.       OPEN (3, FILE='al.txt',  ERR=1)
  11.       OPEN (4, FILE='vec.txt', ERR=1)
  12.  
  13.       OPEN (5, FILE='ia.dat',  ACCESS='DIRECT', RECL=4, ERR=2)
  14.       OPEN (6, FILE='di.dat',  ACCESS='DIRECT', RECL=4, ERR=2)
  15.       OPEN (7, FILE='al.dat',  ACCESS='DIRECT', RECL=4, ERR=2)
  16.       OPEN (8, FILE='vec.dat', ACCESS='DIRECT', RECL=4, ERR=2)
  17.  
  18.       DO i=1, N1+1
  19.          READ (5, REC = i) ia(i)
  20.          WRITE (1, *) ia(i)
  21.       ENDDO
  22.       ial = ia(N1+1)-1
  23.  
  24.       DO i=1, N1
  25.          READ  (6, REC = i) di(i)
  26.          WRITE (2, *) di(i)
  27.       ENDDO
  28.  
  29.       DO i=1, ial
  30.          READ  (7, REC = i) al(i)
  31.          WRITE (3, *) al(i)
  32.       ENDDO
  33.  
  34.       DO i=1, N1
  35.          READ  (8, REC = i) vec(i)
  36.          WRITE (4, *) vec(i)
  37.       ENDDO
  38.  
  39.       CLOSE(1)
  40.       CLOSE(2)
  41.       CLOSE(3)
  42.       CLOSE(4)
  43.       CLOSE(5)
  44.       CLOSE(6)
  45.       CLOSE(7)
  46.       CLOSE(8)
  47.       GOTO 3
  48.     1 STOP 'Input error: check the input files.'
  49.     2 STOP 'Output error: failed to create direct access file.'
  50.     3 END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement