Constant day field in a date
40 pts.
0
Q:
Constant day field in a date
How do we set the Day of a Date to '01' through out an RPGLE program?
ASKED: Aug 13 2009  8:55 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
500 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Hi,

Use a DS to redefine the date and replace day with '01'

Wilson

//////////

For date-type fields, do this:

DayOfMonth = %SubDt(DateField:*D);
MonthBegin = DateField - %Days(DayOfMonth - 1);

If your datefield is 08/14/2009, this code will subtract 13 days from that to get you to the first of the month.
Last Answered: Aug 14 2009  4:07 AM GMT by Littlepd   500 pts.
Latest Contributors: WilsonAlano   2005 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Susweta   40 pts.  |   Aug 14 2009  6:27AM GMT

How do we set the Day of a Date to ‘01′ through out an RPGLE program? Also it should be applicable to any date taken?

 

WilsonAlano   2005 pts.  |   Aug 14 2009  6:27PM GMT

The answer of Litllepd is perfect for any date and doesn’t need a DS.
Wilson

 
0