單位在AIX上運行的Fortran 90。試圖編譯和運行此代碼,我得到一個錯誤,說:的Fortran錯誤:連接到格式的文件
The unformatted I/O statement on unit 200 cannot be completed because the unit is connected to the formatted file /filepath/TB_20160610023926_bufr_v620.dat.
The program will recover by ignoring the I/O statement.
我不完全確定這個錯誤的含義。我只打開一次文件,單元號碼沒有連接到任何其他文件。
INTEGER,PARAMETER :: GRID_TB_UNIT = 200
tbhmap=0
CALL SYSTEM('mkdir -p ' // TRIM(data_path) // '/' // &
TRIM(TB_PREFIX) // '/' // &
date_str)
OPEN(UNIT = GRID_TB_UNIT, &
file = TRIM(TB_binary_filename), &
STATUS = 'REPLACE', &
ACCESS = 'SEQUENTIAL', &
FORM = 'FORMATTED')
nrecg = 0
DO rr=1,720
DO cc=1,1440
IF(countgrid(cc,rr) < 1)CYCLE
nrecg = nrecg+1
tbhmap(cc,rr) = tbhgrid(cc,rr)/countgrid(cc,rr)
timemap(cc,rr) = timegrid(cc,rr)/countgrid(cc,rr)
GRID_TB_record%row = rr
GRID_TB_record%col = cc
GRID_TB_record%year = yeargrid(cc,rr)
GRID_TB_record%month = monthgrid(cc,rr)
GRID_TB_record%time = timemap(cc,rr)
GRID_TB_record%tbh425 = tbhmap(cc,rr)
WRITE(GRID_TB_UNIT,REC=nrecg)GRID_TB_record
END DO
END DO
CLOSE(GRID_TB_UNIT)
@HighPerformanceMark這導致了另一個錯誤:'的REC =說明符不能出現在一個列表或名稱列表數據傳輸statement.' – kkd92