      PROGRAM ROFS
c
c Program to calculate R(Q,s)
c
        implicit none
        real*8 Sq,qq,u3,u5,u6,mins,maxs,ds,s,pi,rs
	real*8 rqs
        integer*4 i,j
	character*60 ofile
	external rqs
        common /parm/ u3,u5,u6,qq
c
c Obtain required parameters at run time
c
	write (*,'(T5,A,$)') 'Enter Q, S(Q):'
	read (*,*) qq,sq
	write (*,'(T5,A,$)') 'Enter b3 (1/A^4), b5 (1/A^8) and b6 (1/A^8) :'
	read (*,*) u3,u5,u6
	write (*,'(T5,A,$)') 'Enter min, max and interval for s: '
	read (*,*) mins,maxs,ds
	write (*,'(T5,A,$)') 'Give output data file :'
	read (*,'(A)') ofile 
	j = (maxs-mins)/ds+1
	open (unit=10,file=ofile,status='unknown')
	INQUIRE (unit=10,name=ofile)

c
c Calculate Function
c
c	write (*,*) ' j = ',j
        DO i = 1,j
	   s = mins + ds*(i-1)
	   write (10,'(3G12.4)') s,RQS(s),0.001
        END DO
	call strtrim(ofile,ofile,j)
	write (*,*) ' '
	write (*,*) ' Output stored in '//ofile(1:j)
	STOP
	END

*_____________________________________________________________________________
        REAL FUNCTION RQS*8(s)          
*_____________________________________________________________________________
	implicit none
        real*8 s,u3,u5,u6,qq,arg
        common /parm/ u3,u5,u6,qq
        arg = -(u6/qq**2)*s**6/720
        IF (ABS(arg).LE.60.0) THEN
           RQS = EXP(arg)*COS((u3/qq)*s**3/6-(u5/QQ**3)*s**5/120)
        ELSE
           RQS = 0.0
        END IF
	RETURN
	END




