10 pts.
 RPGLE day, month and year calculation
I want to fixed the day by hardcode, retrieve the year from system and want the month 6 month before. can anyone help me...

Software/Hardware used:
ASKED: October 18, 2012  7:16 AM
UPDATED: October 18, 2012  12:33 PM

Answer Wiki:
I'll do something similar to get the last day of a month. For your issue ... Get *DATE as ccyymmdd and load it to a data structure with DD specified in positions 7-8. Set DD=01. Put that ccyymmdd value into a Date (type) field and SUBDUR by 6 months. The result should be what you want.
Last Wiki Answer Submitted:  October 19, 2012  7:01 pm  by  aceofdelts   1,565 pts.
All Answer Wiki Contributors:  aceofdelts   1,565 pts. , Michael Tidmarsh   14,060 pts. , fariha123   10 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

To be sure about what you are asking, you want to have a day-number as a constant in your program. For example, you might have [ DayNumber = 10 ] coded into the program. Then you will retrieve the system YEAR value. Then you want the month number for 6 months before… the current date?
 
Since today is October 18, 2012, you would have DayNumber = 10, YEAR = 2012, and MONTH = 4. The resulting date would be April 10, 2012.
 
Is that the kind of thing you need?
 
If not, can you provide a couple better examples?
 
Tom

 110,135 pts.