-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmwch4.f
62 lines (62 loc) · 1.7 KB
/
dmwch4.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
54
55
56
57
58
59
60
61
62
SUBROUTINE DM_WCH4 ( iflno, isword, nword, cdata, iret )
C************************************************************************
C* DM_WCH4 *
C* *
C* This subroutine writes an array of CHARACTER*4 data to a DM file. *
C* *
C* DM_WCH4 ( IFLNO, ISWORD, NWORD, CDATA, IRET ) *
C* *
C* Input parameters: *
C* IFLNO INTEGER File number *
C* ISWORD INTEGER Start word *
C* NWORD INTEGER Number of words *
C* CDATA (NWORD) CHAR*4 Character data *
C* *
C* Output parameters: *
C* IRET INTEGER Return code *
C* 0 = normal return *
C* -6 = write error *
C* -7 = read error *
C** *
C* Log: *
C* M. desJardins/GSFC 5/87 *
C* M. desJardins/NMC 4/91 Add write to different machines *
C************************************************************************
INCLUDE 'GEMPRM.PRM'
INCLUDE 'dmcmn.cmn'
C
CHARACTER*(*) cdata (*)
C------------------------------------------------------------------------
iret = 0
IF ( nword .le. 0 ) RETURN
C
C* Set machine type to current machine so that strings will not be
C* translated.
C
mmsave = kmachn ( iflno )
kmachn ( iflno ) = MTMACH
C
C* Loop through input array. Convert to integer and write to file.
C
iwrite = isword
istart = 1
DO WHILE ( istart .le. nword )
iend = istart + MMSPCE - 1
IF ( iend .gt. nword ) iend = nword
knt = iend - istart + 1
CALL ST_CTOI ( cdata (istart), knt, intarr, ier )
CALL DM_WINT ( iflno, iwrite, knt, intarr, iret )
IF ( iret .ne. 0 ) THEN
istart = nword + 1
ELSE
iwrite = iwrite + knt
istart = iend + 1
END IF
END DO
C
C* Reset machine type.
C
kmachn ( iflno ) = mmsave
C*
RETURN
END