      program test_day_in_week 
!                                                                       
!     ***************************************************************0**
! *   Test_Day_in_Week: compute day in a week, to check with calendars. 
!     P. Robert, Dec 2006                                               
!     ***************************************************************0**
!                                                                       
      character*9 cmonth,cday 
!                                                                       
      print* 
      print 100, '************' 
      print* 
      print 100, 'doweek: compute day in the week for given year' 
      print* 
!                                                                       
      do 10 iyear=1999,2018 
!                                                                       
      do 10 imonth=1,12 
!                                                                       
      call cp_en_month_name(imonth,cmonth,nbcha) 
      call cp_nbday_in_month(iyear,imonth,nbday) 
!                                                                       
      print 100, '--------------' 
      print 200, cmonth,iyear 
      print 100, '--------------' 
                                                                        
  200 format(a,1x,i4) 
!                                                                       
      do 10 iday=1,nbday 
!                                                                       
      call cv_date_to_dotw(iyear,imonth,iday,idow) 
      call cp_en_day_name(idow,cday,nbcha) 
!                                                                       
      print 100, cday,iday 
      if(cday(1:6).eq.'Sunday') print 100, ' ' 
!                                                                       
   10 continue 
!                                                                       
  100 format(a,i3) 
!                                                                       
      print* 
      print 100, '************' 
      print* 
                                                                        
      stop 'test_day_in_week.exe: normal termination' 
      END                                           
