Generating dates between two dates

HI,
i have row like this

HHH100037440313438961000201001012012073110220002  N

in this i have 2 dates in pos 25-32 and 33-40 , so based upon the se two dates , i need to generated records between these two values
so in the above record 20100101 and 20120731
need to genearte rows like this

HHH100037440313438961000201001012012073110220002  N
HHH100037440313438961000201101012011123110220002  N
HHH100037440313438961000201201012012073110220002  N

pleae advice how to generate this

thanks for your help

Just to get the logics right, wouldn't your output's first line second date need to be 20101231?

how you are getting 20111231 in row two.
is it last date of previous year of given row always.

if the dates are like this 20100101 20120730 , then i need to generate two two rows

20100101 20101231
20110101 20111231
20120101 20120730

awk '
{	p1=substr($0,1,24);
	p2=substr($0,25,4);
	p3=substr($0,29,4);
	p4=substr($0,33,4);
	p5=substr($0,37,4);
	p6=substr($0,40);
	for(i=0;i<=p4-p2;i++)
		{
			d=p2+i;
			if(d==p4)
				{
					p5n=p5
				}
			else
				{
					p5n="1231"
				};
			print p1 d p3 d p5n p6
		}
}'  filename

output is

HHH1000374403134389610002010010120101231110220002  N
HHH1000374403134389610002011010120111231110220002  N
HHH1000374403134389610002012010120120731110220002  N