5 * Purpose
: to sum the numbers from num
.dat
6 * Source
: Fortran
77 (compiled under Linux
/fort77
)
7 * Author
: pc2@ecs
.csus
.edu
(laned
)
9 * OS
: Tested under Linux
10 * $Id
: sumit
.f
,v
1.1 2005/03/06 05:13:57 laned Exp $
13 * On Open the STATUS can be
:
16 * 'NEW" - create the file
17 * 'SCRATCH
' - this file is only used as long as the program runs
18 * 'UNKNOWN
' - none of the above, depends on OS
20 * IOSTAT returns an INTEGER
22 * .lt. 0 - error during I/O
37 OPEN (UNIT = 5, FILE=INFILE, STATUS='OLD
', IOSTAT=IOS)
39 IF (IOS .NE. 0) GOTO 200
43 READ (5, 500, IOSTAT = IOS) IVALUE
44 * READ (5, '(I
)', IOSTAT = IOS) IVALUE
46 IF (IVALUE .GT. 0) THEN
47 THESUM = THESUM + IVALUE
50 IF (IOS .NE. 0) GOTO 200
51 IF (IVALUE .EQ. 0) GOTO 200
58 PRINT *, 'FILE NOT FOUND
',INFILE
60 ELSE IF (IOS .GT. 0) THEN
61 PRINT *, 'ERROR NUMBER
', IOS, ' ON FILE
',INFILE
65 PRINT *, 'THE SUM IS
',THESUM