• Subject: RE: Last Day of Last Month
  • From: "Martin, Booth" <BoothM@xxxxxxxxxxx>
  • Date: Wed, 13 Oct 1999 11:11:46 -0400

One easy method would be to write a small RPGIV program with a parm for the
date.  Pass in the parm with the year and month filled in.  Add 1 to the
month, z-add 1 to the day, and then subdur 1 day and pass that date back as
the parm.  (don't forget to check for month 13 btw)
Another way, in the CL, would be to z-add 31 to the day and do a cvtdat. 
Monitor for an error.  If an error then loop back, sub 1 from the day and
retry till the error doesn't occur.

-----Original Message-----
From: Brad McDaniel [mailto:BMCDANIEL@ABSBC.ORG]
Sent: Wednesday, October 13, 1999 9:31 AM
To: boothm@goddard.edu
Subject: Last Day of Last Month

I am writing some CL's to automate some monthly jobs that are usually
submitted through user menus.  This particular CL submits a job with the
prior month and year as the parms (let's say &YEAR (4) and &MONTH (2)). 
Then, the CL does a STRQMQRY with the year, month, and day of the last day
of that month.  Does anyone have a sample of the easiest way to figure out
the last day of a particular month (i.e.  if run today, the year and month
would be 1999 09, and the CL would need to pass 19990930 to the query.)?

| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.