c********************************************************** c* fortran program to read and write gcoast.asc (file 21) * c********************************************************** character name*6, allname*7 character comma integer i, num, nlin real x, y c********************************************************* c* open files for input/output * c********************************************************* open(unit=5,file='gcoast.asc',readonly,status='old') open(unit=6,file='gcoast.out',status='new') c********************************************************* c* read/write the line segment id and x,y coordinates * c********************************************************* 10 nlin=0 read(5,100,end=999) name,comma,num if (comma.eq.'-') num=num*-1 if (comma.eq.',') then allname=name//',' else allname=name//' ' end if write(6,130) write(6,110) allname, 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) x,comma,y write (6,120) x,comma,y 20 continue go to 10 100 format (a6,a1,i6) 110 format (a7,i6) 120 format (f8.4,a1,f7.4) 130 format (1x,'name,number') 140 format (1x,'x ,y ') c*********************************************************** c***** close files and exit ****** c*********************************************************** 999 close(unit=5) close(unit=6) stop end