-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmfwrt.f
53 lines (53 loc) · 1.35 KB
/
dmfwrt.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
SUBROUTINE DM_FWRT ( iflno, iret )
C************************************************************************
C* DM_FWRT *
C* *
C* This subroutine flushes the write buffers for a DM file. *
C* *
C* DM_FWRT ( IFLNO, IRET ) *
C* *
C* Input parameters: *
C* IFLNO INTEGER File number *
C* *
C* Output parameters: *
C* IRET INTEGER Return code *
C* 0 = normal return *
C* -4 = file not open *
C* -6 = write error *
C** *
C* Log: *
C* M. desJardins/GSFC 3/87 *
C************************************************************************
INCLUDE 'GEMPRM.PRM'
INCLUDE 'GMBDTA.CMN'
INCLUDE 'dmcmn.cmn'
C-----------------------------------------------------------------------
C* Check that the file is open.
C
CALL DM_CHKF ( iflno, iret )
IF ( iret .ne. 0 ) RETURN
C
C* Check each buffer in cache to see if it belongs to this file
C* number and should be written.
C
DO i = 1, MCACHE
C
IF ( ( kwrite (i) ) .and. ( kcflno (i) .eq. iflno ) ) THEN
C
C* Write data and reset flag.
C
CALL FL_WRIT ( lundm ( iflno), kcrecn (i), MBLKSZ,
+ kcdata ( 1, i ), iflerr )
kwrite (i) = .false.
C
C* Print error message.
C
IF ( iflerr .ne. 0 ) THEN
C CALL ER_WMSG ( 'FL', iflerr, ' ', ier )
iret = -6
END IF
END IF
END DO
C*
RETURN
END