I am getting the wrong result in the %DIFF function. See following code:
D total_hours s 9 2 inz(0)
D time1 S t inz(T'12.00.00')
D time2 S t inz(T'13.38.00')
/Free total_hours = %diff(time2 : time1 : *h);
*inLR = *on;
/End-Free
C RETURN
I was expecting 1.38. and I am getting 1.00.
Any suggestions?
Software/Hardware used:
RPGLE AS/400
ASKED:
January 12, 2012 6:57 PM
UPDATED:
March 17, 2012 5:39 AM
%diff(time2 : time1 : *h); *h — number of hours — 1 hour
%diff(time2 : time1 : *minutes); number of minutes
returns not 1.38 but 60 + 38 = 98
Hope this helps
Phil
Actually, %DIFF returns an integer of the number of FULL units between the 2 values
so you will only see 1.00 in your total hour field what you want is to retrieve the minutes divided by 60;
d total_hours s 9p 2 d time1 s t inz(T'12.00.00') d time2 s t inz(T'13.38.00') /free total_hours = %diff(time2 : time1 : *mn)/60; dump(a); *inlr = *on; /end-freeThanks for your help.