Thanks ed for you help. The function I have wrote, does anyone out there know of a quicker/better way to perform this all advice is more than welcome.
FUNCTION add_month_to_date( ps_no_of_months=4 )
DEFINE
ps_no_of_months SMALLINT
DEFINE
ls_day SMALLINT,
ls_month SMALLINT,
ls_year SMALLINT,
ls_loopday SMALLINT,
ld_today DATE,
ld_tdate DATE,
lc_date CHAR(10)
INITIALIZE ls_day, ls_month, ls_year, ld_date TO NULL
LET lc_date = ""
LET ld_today = "31/10/2003"
LET l_tdate = ld_today + ps_no_of_months UNITS MONTH
IF ld_tdate IS NULL THEN
LET ls_day = DAY(ld_today)
LET ls_month = MONTH(ld_today)
LET ls_year = YEAR(ld_today)
LET ls_month = ls_month + ps_no_of_months
IF ls_month > 12 THEN
LET ls_year = ls_year + 1
LET ls_month = ls_month - 12
END IF
LET lc_date = ls_day USING "&&", "/",
ls_month USING "&&", "/",
ls_year USING "&&&&"
LET ld_tdate = lc_date
IF ld_tdate IS NULL THEN
FOR ls_loopday = 31 TO 28 STEP - 1
LET lc_date = ls_loopday USING "&&", "/",
ls_month USING "&&", "/",
ls_year USING "&&&&"
LET ld_tdate = lc_date
IF ld_tdate IS NOT NULL THEN
EXIT FOR
END IF
LET lc_date = ""
END FOR
END IF
END IF
RETURN ld_tdate
END FUNCTION