• Subject: RE: Last Day of Last Month
  • From: Jon Erickson <jerickson@xxxxxxx>
  • Date: Wed, 13 Oct 1999 08:01:28 -0700

Brad,
 
It may be easier to do this is a RPG IV program by using the &year and
&month parms as part of an initialized *ISO date field, (defaults to
0000-01-01).
 
d                 DS                                    
d Isodate                         d   Inz               
d  Isoyyyy                       4  0 Overlay(Isodate)  
d  Isomm                         2  0 Overlay(Isodate:6)
 
Add 1 month via ADDDUR
c                   AddDur    1:*Months     Isodate

Subtract 1 day via SUBDUR
c                   SubDur    1:*Days       Isodate
 
The result will be the last day of the &month, &year combination.  You could
then use QCMDEXC to submit/call the QMQRY.
 
Jon A. Erickson 
Sr. Programmer Analyst 
800.COM Inc. 
1516 NW Thurman St 
Portland, OR  97209-2517 

Direct: 503.944.3613 
Fax: 503.944.3690 
Web: http://800.com <http://800.com/>  

-----Original Message-----
From: Brad McDaniel [mailto:BMCDANIEL@ABSBC.ORG]
Sent: Wednesday, October 13, 1999 6:31 AM
To: 'midrange-l@midrange.com'
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.)?

I know the method for passing parms with STRQMQRY, I am just wondering if
anyone has some code laying around that gives you the last day of the month
(accounting for leap years also).

Thanks   

Brad McDaniel 
Information Services 
Annuity Board, SBC 
http://www.absbc.org <http://www.absbc.org>  
214-720-6546 

+---
| 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
+---

This thread ...


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

This mailing list archive is Copyright 1997-2019 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].