program prtobs c Expects the input file as a directed input, c e.g. a.out < data_ascii c or if compressed, zcat data_ascii.Z |a.out ' character*3 rectyp character*4 elmtyp character*2 eunits character*1 src1,src2,flag1,flag2,flg1,flg2 character*4 itime,jtime character*6 ivalue,jvalue character ibuf*13000 dimension itime(100),ivalue(100),flag1(100),flag2(100) dimension jtime(100),jvalue(100),flg1(100),flg2(100) c itape=10 nrecs=0 lrecs=0 numval=0 c*** print spread sheet header print 24 24 format('type, station, type, units, year, mo, da, s1, s2, #values *,', 24(' hour, value, f1, f2,')) c c*** read block from storage device 10 continue ib=1 read(5,'(a)',end=50) ibuf nrecs=nrecs+1 c c*** read next logical record (record type) in block or read next block 15 continue c c*** read variables that identify record, c*** idstn is a 5-digit WBAN number, right-justified in the eight characters c*** and zero-filled read(ibuf(ib:),20,err=10) ibytes,rectyp,idstn,elmtyp,eunits, * iyr,imo,src1,src2,ida,numval c print 20,ibytes,rectyp,idstn,elmtyp,eunits, c * iyr,imo,src1,src2,ida,numval 20 format(i4,a3,i8,a4,a2,i4,i2,a1,a1,i2,i3) if(ibytes.le.0) go to 10 lrecs=lrecs+1 c print 2020,nrecs,lrecs,ib,ibytes 2020 format(4i10) c c*** select records here (go to 40 to reject record) c if(idstn.lt. 0) go to 40 c do 2021 i=1,24 itime(i)=' ' ivalue(i)=' ' flag1(i)=' ' flag2(i)=' ' 2021 continue c*** read data values from selected record read(ibuf(ib+34:),21,err=44) * (jtime(j),jvalue(j),flg1(j), * flg2(j),j=1,numval) c print 21, c * (jtime(j),jvalue(j),flg1(j), c * flg2(j),j=1,numval) 21 format(100(a4,a6,2a1)) do 2121 i=1,numval read(jtime(i),'(i4)',err=44) j j=(j/100)+1 itime(j)=jtime(i) ivalue(j)=jvalue(i) flag1(j)=flg1(i) flag2(j)=flg2(i) 2121 continue c c*** print selected record print 25,rectyp,idstn,elmtyp,eunits,iyr,imo,ida,src1,src2,numval, * (itime(j),ivalue(j),flag1(j),flag2(j),j=1,24) 25 format( * 1x,a3,', ',i7,', ',a4,', ',3x,a2,', ',i4,', ',i2,', ', * i2,', ', * 1x,a1,', ',1x,a1,', ',4x,i3,', ', * 24(a4,', ',1x,a6,', ',1x,a1,', ',1x,a1,', ')) c c*** set up character pointers for next record 40 ib=ib+ibytes go to 15 c c*** error condition dump record 44 continue ie=ib+ibytes-1 print 45,nrecs,lrecs,ib,ibytes,ibuf(ib:ie) 45 format(4i10,1x,(a)) go to 40 50 continue end