        character line*120,coded*120
        do 49 i=1,120
          coded(i:i)=' '
          line(i:i)=' '
  49    continue

  46    write (*,*)'What shift do you want to use?'
        read(*,*)ishift
        if(ishift.lt.-25.or.ishift.gt.25)then
          write(*,*)'Give shift in range -25 to 25.'
          go to 46
        end if
  45    write(*,*)'Do you want (1) UPPER CASE or (2) lower case'
        read(*,*)icase
        if(icase.ne.1.and.icase.ne.2)go to 45
       
        open(8,file="Caesar.txt",form="formatted")
  1     read(8,1000,end=2)line
c       write(*,1000)line
c       do 47 i=1,120
c 47      write(*,*)line(i:i),ichar(line(i:i))
1000    format(a120)
        do 15 i=1,120
          nl=ichar(line(i:i))
          if(nl.ge.97.and.nl.le.122)then
            nl=nl-32
          end if
          if(nl.ge.65.and.nl.le.90)then
            nl=nl+ishift
            if(nl.gt.90)nl=nl-26
            if(nl.lt.65)nl=nl+26
            if(icase.eq.2)nl=nl+32
          end if
          if(nl.lt.32)nl=32
          coded(i:i)=char(nl)
c         write(*,*)i,nl,line(i:i)//'  '//char(nl)//'  '//coded
  15    continue
        write(*,1000)coded
        go to 1

  2     close(8)

        stop
        end
