C -----------------------------------------------------------
C -----------------------------------------------------------
      subroutine blet0(alet0,alet1)
c
	CHARACTER*1 IN0(1:26),IN1(1:26),ALET
	CHARACTER*4 alet0,alet1
	DATA IN0/'A','B','C','D','E','F','G','H','I','J'
	+,'K','L','M','N','O','P','Q','R','S','T'
     +,'U','V','W','X','Y','Z'/
	DATA IN1/'a','b','c','d','e','f','g','h','i','j'
	+,'k','l','m','n','o','p','q','r','s','t'
     +,'u','v','w','x','y','z'/
C
	alet1=alet0
	DO k=1,4
	ALET=ALET0(k:k)
    5	do i=1,26
     	if (ALET.eq.IN0(i)) then
 	alet1(k:k)=IN1(i)
	exit
	endif
	enddo 
	ENDDO
	return
	end
C
      subroutine blet1(ilet,alet1)
c

	CHARACTER*1 IN(0:9)
	integer*1 ilet
	DATA IN/'0','1','2','3','4','5','6','7','8','9'/
	CHARACTER*1 alet1
	alet1='0'
	j1=ilet
    5	do i=0,9
     	if (j1.eq.i) then
 	alet1=IN(i)
	endif
	enddo 
	return
	end
C
      subroutine blet2(ilet,alet2)
c

	CHARACTER*1 IN(0:9)
C	integer*2 ilet
	DATA IN/'0','1','2','3','4','5','6','7','8','9'/
	CHARACTER*2 alet2
	alet2='00'
	j10=ilet/10
	j1=ilet-j10*10
    5	do i=0,9
	if (j10.eq.i) then
	alet2(1:1)=IN(i)
	endif
	enddo
   7	do i=0,9 
     	if (j1.eq.i) then
 	alet2(2:2)=IN(i)
	endif
	enddo 
	return
	end
C
      subroutine blet3(ilet,alet3)
c     nn=1,2,3,4 

	CHARACTER*1 IN(0:9)
	DATA IN/'0','1','2','3','4','5','6','7','8','9'/
	CHARACTER*3 alet3
	alet3='000'
C
	j100=ilet/100
	      j10=(ilet-j100*100)/10
	j1=ilet-j100*100-j10*10
    3	do i=0,9
		if (j100.eq.i) then
	alet3(1:1)=IN(i)
	endif
	enddo
    5	do i=0,9
	if (j10.eq.i) then
	alet3(2:2)=IN(i)
	endif
	enddo
   7	do i=0,9 
     	if (j1.eq.i) then
 	alet3(3:3)=IN(i)
	endif
	enddo 
	return
	end
C
      subroutine blet4(ilet,alet4)
c     nn=1,2,3,4 
C
	CHARACTER*1 IN(0:9)
	DATA IN/'0','1','2','3','4','5','6','7','8','9'/
	CHARACTER*4 alet4
	alet4='0000'
C
	j1000=ilet/1000
	      j100=(ilet-j1000*1000)/100
	j10=(ilet-j1000*1000-j100*100)/10
	j1=ilet-j1000*1000-j100*100-j10*10
    3	do i=0,9
		if (j1000.eq.i) then
	alet4(1:1)=IN(i)
	endif
		if (j100.eq.i) then
	alet4(2:2)=IN(i)
	endif
	enddo
    5	do i=0,9
	if (j10.eq.i) then
	alet4(3:3)=IN(i)
	endif
	enddo
   7	do i=0,9 
     	if (j1.eq.i) then
 	alet4(4:4)=IN(i)
	endif
	enddo 
	return
	end
C
      integer function ndoy(iyr,imn,idy)
C To define day-of-year
C
	       DIMENSION IM(12)
	integer*2 iyr,imn,idy
	DATA IM/31,28,31,30,31,30,31,31,30,31,30,31/
	z1=iyr/4.0
      jz1=int(z1)*4
      IF(jz1.EQ.iyr) THEN
               IM(2)=29
        ELSE
                IM(2)=28
	       ENDIF
C Day-of-year LDA1
		mosum=0
      if(imn.gt.1) then
         do 1234 i=1,imn-1
1234    mosum=mosum+im(i)
         endif
      ndoy=mosum+idy	
	END FUNCTION
C ===============================================================
