********************************************************************* * TO COMPILE: * * CRTBNDRPG PGM(xxx/DATESTUFF1) SRCFILE(xxx/QRPGLESRC) * ********************************************************************* * This program demonstrates how to retrieve the current date, * how to add one month to the current date, how to subtract * one month from the current date, how to add 30 days to the * current date and how to subtract 30 days from the current date. * Lastly, the program will show how to find the last day of the * month for a given date. * ********************************************************************* H Datedit(*mdy) D Current_Date S 8 0 D WorkDate S D DATFMT(*USA) D Days S 2 0 * Retrieve current date C Eval Current_Date = *Date C Current_Date Dsply * Move Current Date to WorkDate C Move Current_Date WorkDate C WorkDate Dsply * Add 1 Month to WorkDate C Adddur 1:*Months WorkDate C WorkDate Dsply * Subtract 1 Month from WorkDate C Subdur 1:*Months WorkDate C WorkDate Dsply * Add 30 Days to WorkDate C Adddur 30:*D WorkDate C WorkDate Dsply * Subtract 30 days from WorkDate C Subdur 30:*D WorkDate C WorkDate Dsply * Find the last day of the month for this date C Move Current_Date WorkDate C Adddur 1:*M WorkDate C Extrct WorkDate:*D Days C Subdur Days:*D WorkDate C WorkDate Dsply C Eval *InLr = *On