I have dates that come into my program as cn yy mm dd. I put these pieces in a ISO data structure to do some calcs. I want to find how many months transpired between to dates using the %diff. Can I do this with the dates being in a data structure? My program is telling me my parameters are invalid.
Here's my set up.
IF %Diff(REPTXDATE: +
CALCLOSS: *MONTHS)<=12
ADD 1 I1Y12MX Thanks!!!
Software/Hardware used:
ASKED:
February 27, 2006 11:59 AM
UPDATED:
November 30, 2009 6:02 AM
You need to use real date fields in the %diff function.
d bumand s d
d demand s d
d busched s 7s 0 *this in in format CYYMMDD
d DECURS s 7s 0 *this in in format CYYMMDD
d months s 5s 0
bumand = %date(busched:*cymd) ;
demand = %date(decurs:*cymd) ;
months = %diff(bumand:demand:*months) ;
if your incoming date format is CCYYMMDD, then use *ISO instead of *CYMD
Note that “real date fields” are not required for %diff(). As with many %bifs, the parameters may be results of other %bifs. For %diff(), you can use the %date() function against numeric fields in order to convert values without needing “real date fields”.
Tom