-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdmrch4.f
70 lines (70 loc) · 1.85 KB
/
dmrch4.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
63
64
65
66
67
68
69
70
SUBROUTINE DM_RCH4 ( iflno, isword, nword, cdata, iret )
C************************************************************************
C* DM_RCH4 *
C* *
C* This subroutine reads an array of character*4 data from a DM file. *
C* *
C* DM_RCH4 ( IFLNO, ISWORD, NWORD, CDATA, IRET ) *
C* *
C* Input parameters: *
C* IFLNO INTEGER File number *
C* ISWORD INTEGER Start word *
C* NWORD INTEGER Number of CHAR*4 strings *
C* *
C* Output parameters: *
C* CDATA (NWORD) CHAR*4 Character data *
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/GSFC 6/88 Documentation *
C* M. desJardins/GSFC 5/90 Add translation for diff 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
C* be translated.
C
mmsave = kmachn ( iflno )
kmachn ( iflno ) = MTMACH
C
C* Read data and convert to character.
C
iread = isword
istart = 1
C
C* Loop through reading data as integers into intarr which is
C* dimensioned to MMSPCE.
C
DO WHILE ( istart .le. nword )
iend = istart + MMSPCE - 1
IF ( iend .gt. nword ) iend = nword
knt = iend - istart + 1
CALL DM_RINT ( iflno, iread, knt, intarr, iret )
IF ( iret .ne. 0 ) THEN
istart = nword + 1
ELSE
C
C* Convert from integer to character.
C
CALL ST_ITOC ( intarr, knt, cdata (istart), ier )
iread = iread + knt
istart = iend + 1
END IF
END DO
C
C* Reset machine type.
C
kmachn ( iflno ) = mmsave
C*
RETURN
END