c********************************************************** c* fortran program to read and write wcoast.asc (file 21) * c********************************************************** character id*6, name*7 character comma integer i, num, nlin real long, lat c********************************************************* c* open files for input/output * c********************************************************* open(unit=5,file='wcoast.asc',readonly,status='old') open(unit=6,file='wcoast.out',status='new') c********************************************************* c* read/write the line segment id and x,y coordinates * c********************************************************* 10 nlin=0 read(5,100,end=999) id,comma,num if (comma.eq.'-') num=num*-1 if (comma.eq.',') then name=id//',' else name=id//' ' end if write(6,130) write(6,110) name, num c******************************************************** c* read and print x,y coordinates for the line * c******************************************************** do 20 i = 1, num*-1 if (nlin.gt.77) nlin=0 if (nlin.eq.0) write (6,140) nlin=nlin+1 read (5,120) long,comma,lat write (6,120) long,comma,lat 20 continue go to 10 100 format (a6,a1,i6) 110 format (a7,i6) 120 format (f9.4,a1,f8.4) 130 format (1x,'name , number') 140 format (1x,'longitude,latitude') c*********************************************************** c***** close files and exit ****** c*********************************************************** 999 close(unit=5) close(unit=6) stop end