program Resequence ! Resequence an Autocoder deck in columns 72-75. ! If the -s option is specified, delete the overlay entry cards, ! (with N000000,040040,040040,040040 in 40-67) (except the first one), ! replacing the 1040 in columns 68-71 of the previous card with the ! branch in columns 68-71 of those cards. ! Overlay reboot cards beginning with ! ,015022)024056,029036 ! ,068072)063067/061039 ! are also removed. ! Circumflex in 1-39 are replaced by blank integer :: First = 0 integer :: i integer :: Seq = 0 logical :: Short = .false. character(len=80) :: Prev, Curr call getarg ( 1, prev ) prev = trim(adjustl(prev)) if ( prev == '-s ' ) then short = .true. else if ( prev /= '' ) then call getarg ( 0, prev ) print '(3a)', 'Usage: ', trim(adjustl(prev)), ' [-s] out' print '(a)', ' the -s option removes the overlay entry cards, moving' print '(a)', ' the branch in columns 68-71 to the previous card' stop end if read ( *, '(a)', end=9 ) prev do read ( *, '(a)', end=9 ) curr if ( curr(1:21) == ',015022)024056,029036' .or. & & curr(1:21) == ',068072)063067/061039' ) cycle do i = 1, 40 if ( prev(i:i) == "^" ) prev(i:i) = " " end do if ( short ) then if ( curr(40:67) == 'N000000,040040,040040,040040' ) then if ( first == 0 ) then first = 1 else seq = seq + 1 write ( *, '(2a,i4.4,a)' ) & & prev(1:67), curr(68:71), seq, prev(76:80) prev = curr cycle end if end if end if if ( short ) then if ( prev(40:67) /= 'N000000,040040,040040,040040' ) then seq = seq + 1 write ( *, '(a,i4.4,a)' ) prev(1:71), seq, prev(76:80) else if ( first < 2 ) then first = 2 seq = seq + 1 write ( *, '(a,i4.4,a)' ) prev(1:71), seq, prev(76:80) end if else seq = seq + 1 write ( *, '(a,i4.4,a)' ) prev(1:71), seq, prev(76:80) end if prev = curr end do 9 continue seq = seq + 1 write ( *, '(a,i4.4,a)' ) curr(1:71), seq, curr(76:80) end program Resequence