|
If you can use ILE, try the date/time functions of the ILE CEE APIs. Works if you can get the first of the next month. CRTCLMOD, then CRTPGM with binding *SRVPGM QLEAWI. (CRTBNDCL does not let you bind a service program.) ============================= pgm dcl &numdays *char 4 dcl &newdate *char 8 CALLprc CEEDAYS ('06/01/02' 'MM/DD/YY' &numdays) chgvar %bin(&numdays) (%bin(&numdays) - 1) CALLprc CEEDATE (&numdays 'YY/MM/DD' &newdate) endpgm ============================= CEEDAYS gives you the number of days after October 14, 1582 (so-called Lillian date - huh?). Thew 2nd parameter is a format string. The veriety here is great. The %BIN builtin function of CL lets you subtract 1 day (or any number of days) from a binary value (an INT represented in a CHAR). CEEDATE converts a Lillian date to any of several text strings. Note that the templates are different. The result here is '02/05/31'. Here's debug output: ========================== > EVAL &olddate &OLDDATE = '06/01/02' > EVAL &numdays:x 4 00000 000256B3 > EVAL &numdays:x 4 00000 000256B2 > EVAL &newdate &NEWDATE = '02/05/31' =========================== "Condon, Mike" wrote: > > Is there a way to calculate month start/month end dates using CL only? > _______________________________________________ > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l > or email: MIDRANGE-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. -- Vern Hamberg Would you like to see a challenging little arithmetic puzzle that might get you or your kids or grandkids more interested in math? Go to <http://cgi.wff-n-proof.com/MSQ-Ind/I-1E.htm> Sillygism-- Something is better than nothing. Nothing is better than a ham sandwich. Ergo Something is better than a ham sandwich.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.