program fixcop character*10 file character*14 infile character*14 outfil character*255 line byte bline(255) equivalence (line,bline) byte bbuff(512) open(unit=10,file='fixup.lst',status='old',readonly) 1000 read(10,1001,end=9999) file 1001 format(a10) infile(1:4)='du2:' outfil(1:4)='d31:' infile(5:)=file outfil(5:)=file write(5,1002) infile,outfil 1002 format(1x,'processing ',a14,' to ',a14) open(unit=11,file=infile,status='old', 1 carriagecontrol='list',readonly) open(unit=12,file=outfil,status='new', 1 carriagecontrol='none') open(unit=13,file='du2:newcop.txt',status='old',readonly) c with RT-11 F77, we have to open the output file carriagecontrol='none' c so that there isn't a leading tacked on. mode=2 !searching for blank line c mode=3 !searching for comment with COPYRIGHT c mode=35 !inserting new copyright from unit 13 c mode=4 !searching for non-comment form-feed c mode=5 !spooling to end 10 if (mode.ne.35) then read(11,1,end=200) l,line else read(13,1,end=36) l,line end if 1 format(q,a255) if (mode.eq.5 .or. mode.eq.35) go to 100 if (mode.eq.2) then if (l.ne.0) go to 100 mode=3 go to 100 end if if (mode.eq.3) then if (l.eq.0) go to 100 if (line(1:1).ne.';') then mode=2 go to 100 end if if (index(line,'COPYRIGHT').ne.0) then mode=35 go to 10 else mode=2 go to 100 end if end if if (mode.eq.4) then if (line(1:1).eq.';') go to 10 if (bline(1).ne.12) go to 200 mode=5 go to 100 end if stop !illegal mode 36 mode=4 close(13) go to 10 100 bline(l+1)=13 bline(l+2)=10 l=l+2 write(12,3) line(1:l) 3 format(a) go to 10 200 if (mode.ne.5) write(5,*) 'end of file, mode=',mode close(11) bline(1)=0 !write a zero at end of text file write(12,4) line(1:1) 4 format(a1) close(12) c get rid of niggly last character in last block open(unit=12,file=outfil,status='old', 1 access='direct',recl=128,form='unformatted') do 290 i=1,5000 read(12,rec=i,end=300) bbuff 290 continue stop 300 if (i.eq.1) stop i=i-1 read(12,rec=i) bbuff if (bbuff(511).ne.0) then write (5,*) 'danger: char 511 ne 0' else bbuff(512)=0 write(12,rec=i) bbuff end if close(12) go to 1000 9999 close(10) write(5,*) 'normal successful end of list' end