c--2000sum converts older non-y2k hypoinverse summary files to y2000. c--It is a simplified version of the general purpose 2000conv program. c--This is a standard i/o (filter) version, ie c 2000sum outfile c--converts station, arc and summary files to year 2000 format character li*170, lo*170 !, sta*14, c1*1 c dimension cal(7),id(7), cor(6), iatn(7) c--get file type c write (6,1000) c1000 format ('File types to convert to 2000 format:'/ c 2 'jf=1 calsta2.loc to calsta2000.loc'/ c 3 'jf=2 all2.cal to all2000.cal'/ c 3 'jf=3 all2.xmc to all2000.xmc'/ c 3 'jf=4 all2.fmc to all2000.fmc'/ c 3 'jf=5 all2.atn to all2000.atn'/ c 3 'jf=6 x.sum to x2000.sum'/ c 4 'jf=7 x.arc to x2000.arc') c jf=jask('File format',6) jf=6 c--set line length if (jf.eq.6) llo=164 c--open files c call iofl c--read a line and branch c2 read (2,'(a)',end=110) li 2 read (5,'(a)',end=110) li lli=leng(li) lo=' ' c goto (10,20,30,40,50,60,70), jf c================ sum files ========================= c--assume there are no p amp mags c--substitute leading zeros for blanks 60 if (li(3:3).eq.' ') li(3:3)='0' if (li(5:5).eq.' ') li(5:5)='0' if (li(7:7).eq.' ') li(7:7)='0' if (li(9:9).eq.' ') li(9:9)='0' c lo(1:2)='19' !century c lo(3:36)=li(1:34) !date, loc c lo(37:39)=(li(35:36)//'0') !amp mag c lo(40:70)=li(37:67) !no stas, gap,err c lo(71:73)=(li(68:69)//'0') !dur mag c lo(74:82)=li(70:78) !remarks c lo(83:85)=(' '//li(79:80)) !# s times c lo(86:93)=li(81:88) !errors c lo(94:104)=(' '//li(89:90)//' '//li(91:93)//' 'li(94:96))!# fm, weights c lo(105:150)=li(97:142) !mad, source codes, id # c lo(151:154)=(' '//li(143:145)) !tot pref mag weights c lo(155:158)=li(146:149) !alt coda mag c lo(159:162)=(' '//li(150:152)) !tot alt coda mag weights c lo(163:164)=li(153:154) c--this is slightly faster as one string lo=('19' //li(1:36) //'0' //li(37:69) 2 //'0' //li(70:78)//' ' 2 //li(79:88) //' ' //li(89:90)//' ' 3 //li(91:93)// ' ' //li(94:142) //' ' //li(143:149) 4 //' ' //li(150:154)) c llo=164 c goto 100 c--write output line c100 write (3,'(a)') lo(1:llo) 100 write (6,'(a)') lo(1:llo) goto 2 110 stop end INTEGER FUNCTION LENG (STRING) C C THE NON-BLANK LENGTH OF STRING WHOSE PHYSICAL LENGTH IS MAXLEN C (RETURNS THE POSITION OF THE LAST NON-BLANK CHARACTER) C CHARACTER STRING*(*) ! STRING C INTEGER I ! CHARACTER POSITION INTEGER MAXLEN ! LENGTH OF STRING MAXLEN = LEN(STRING) DO 10 I = MAXLEN,1,-1 IF (STRING(I:I) .NE. ' ') GOTO 20 10 CONTINUE I = 0 20 LENG = I RETURN END