  ScaDate( nNullDate,nSettle,nBase,&sDay,&sMonth,&sYear,&sbLastDayMode,&sbLastDay,&sb30Days,&sbUSMode,&snDay);
    ScaDate( nNullDate,aDate,nBase,&rDay,&rMonth,&rYear,&rbLastDayMode,&rbLastDay,&rb30Days,&rbUSMode,&rnDay);
    rYear=sYear;
    setDay(rDay,rMonth,rYear,rbLastDay,rb30Days,&rnDay);
    if(checklessthan(rYear,sYear,rMonth,sMonth,rnDay,snDay,rbLastDay,sbLastDay,rDay,sDay))
    {
        rYear+=1;
        setDay(rDay,rMonth,rYear,rbLastDay,rb30Days,&rnDay);
    }
    while(checklessthan(sYear,rYear,sMonth,rMonth,snDay,rnDay,sbLastDay,rbLastDay,sDay,rDay))
    {
        double d = -1*(12/nFreq);
        addMonths(rb30Days,rbLastDay,&rnDay,rDay,&rMonth,d,&rYear);
    }
    int nLastDay = DaysInMonth( rMonth, rYear );
    int nRealDay = (rbLastDayMode && rbLastDay) ? nLastDay :min( nLastDay, rDay );
    return DateToDays( nRealDay, rMonth, rYear ) - nNullDate;
}
