Find difference between 2 Dates

To calculate the difference between 2 given Dates, COBOL intrinsic functions can be used.








The below code is present in the above screenshot.

01 WS-DATE-DIFF                PIC S9(08) COMP. 
01 WS-DATE1                    PIC 9(08). 
01 WS-DATE2                    PIC 9(08).  

COMPUTE WS-DATE-DIFF = FUNCTION INTEGER-OF-DATE(WS-DATE2) -  
                       FUNCTION INTEGER-OF-DATE(WS-DATE1)

No comments: