Add Days to a given Gregorian Date

We can easily add number of Days to a given Gregorian Date to get a future Date using COBOL intrinsic functions.








The below code is present in the above screenshot.

01 WS-FUTURE-DATE              PIC 9(08). 
01 WS-ADD-DAYS                 PIC 9(08). 
01 WS-GREGORIAN-DATE           PIC 9(08). 

COMPUTE WS-FUTURE-DATE = FUNCTION DATE-OF-INTEGER            
  (FUNCTION INTEGER-OF-DATE(WS-GREGORIAN-DATE) + WS-ADD-DAYS)

No comments: