program prtobs c c ************ c redirecting the output to another file gives a better visualization c ************ c character*3 rectyp character*4 elmtyp character*2 eunits character*1 src1,src2,flag1,flag2 character ibuf*13000 dimension itime(100),ivalue(100),flag1(100),flag2(100) c itape=10 nrecs=0 lrecs=0 numval=0 c open(itape,file='data_ascii',status='old') c*** read block from storage device 10 continue ib=1 read(itape,'(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 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 c*** read data values from selected record read(ibuf(ib+34:),21,err=44) * (itime(j),ivalue(j),flag1(j), * flag2(j),j=1,numval) 21 format(100(i4,i6,2a1)) c c*** print selected record print 25,rectyp,idstn,elmtyp,eunits,iyr,imo,ida,numval,src1,src2 do 30 jj=1,numval,9 jend=jj+8 if(jend.gt.numval) jend=numval print 26,(itime(j),j=jj,jend) print 27,(ivalue(j),j=jj,jend) print 28,(flag1(j),j=jj,jend) print 29,(flag2(j),j=jj,jend) 25 format(' ---------------------------------------------------',/, * ' record type =',7x,a3,/, * ' id# =',2x,i8,/, * ' element type =',6x,a4,/, * ' units =',8x,a2,/, * ' yr/mo/da =',i4,'/',i2,'/',i2,/, * ' # reported values =',7x,i3,/, * ' source1 =',9x,a1,/, * ' source2 =',9x,a1,/) 26 format(' time in hhmm ',9i7) 27 format(' data value ',9i7) 28 format(' flag 1 ',9a7) 29 format(' flag 2 ',9a7) 30 continue 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