c     bcdred.f
      implicit double precision (A-H,O-Z)
      CHARACTER*10  DAYJJ 
      CHARACTER*50  IDJ 
      character*80   bigib
      DIMENSION IR(4100),WN(1000000),R(1000000) 
C            
C   READ THE BIG INFORMATION BLOCK                                      
C                                                                               
      do 200 k=1,412 
      READ(*,'(A)') bigib
!     write(8,'(A)') bigib
  200 continue    
C                                                                               
      write(6,66)       ! WRITE(8,66)
!  66 FORMAT(//'   NREC NWPP NROLL   DPWREF         PDDELW
!    1PSCAL          PMIN  '/)
   66 FORMAT('##   NREC NWPP NROLL   DPWREF         PDDELW
     1PSCAL          PMIN  ')
c             
      DO 100 I=1,10000                                                          
C                                                                               
C   READ THE SHORT INFORMATION BLOCK                                            
      READ(*,62,END=101) NREC,DAYJJ,IDJ,NWPP,NROLL,        
     1WSTART,DELTAW,PSCAL,PMIN                                                 
   62 FORMAT( I5,1X,a10,1X,a50,I13/I5,1X,F13.5,D20.8,2E20.8)                  
C 
!     WRITE(8,96) NREC,NWPP,NROLL,WSTART,DELTAW,PSCAL,PMIN
      WRITE(6,96) NREC,NWPP,NROLL,WSTART,DELTAW,PSCAL,PMIN
!  96 FORMAT(1X,3I5,F12.4,3D17.7)
   96 FORMAT('#',3I5,F12.4,3D17.7/'# m = 1, S = 1')
c              
C   READ THE DATA                                                               
      READ(*,80) (IR(J),J=1,4100)                                               
   80 FORMAT(10I8)                                                              
C   RESCALE THE DATA                                                            
      DO 86 J=1,4096
      K=4096*(I-1)+J
      WN(K)=WSTART + DELTAW*DFLOAT(J-1)                                        
      R(K)=(DFLOAT(IR(J))/PSCAL)+PMIN
      write(6,77) K,WN(K),R(K)  ! write(7,77) K,WN(K),R(K)
  77  format(I12,f12.4,D20.5)     
  86  continue    
C                                                                               
C   ********************************************************************        
C   *    NOW THE DATA IS IN THE R ARRAY SCALE IDENTICAL TO THE OUTPUT  *        
C   *    OF THE TRANSFORM.                                             *        
C   ********************************************************************        
C                                                                               
  100 CONTINUE                                                                  
C     
  101 stop
      END                                                                       

