× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Mon, 30 Jan 2006, Eric Graeb wrote:

Yes, you can do it programmatically in CL but it would be lengthy.


Ummm...  not counting comments, or DCL statements, it's 4 lines of code.


/* NOTE:  This is ILE CL. Source type is CLLE (not CLP!)          +
                                                                  +
    To Compile:                                                   +
           CRTBNDCL PGM(ENDOFMON) SRCFILE(xxx/xxx)                */
PGM

    DCL VAR(&LILIAN)   TYPE(*CHAR) LEN(4)
    DCL VAR(&NOTUSED1) TYPE(*CHAR) LEN(8)
    DCL VAR(&NOTUSED2) TYPE(*CHAR) LEN(23)
    DCL VAR(&LIBNAME)  TYPE(*CHAR) LEN(7)

    /* Get the Year & Month from 15 days ago.  For example, if    +
       today is Jan 5, 2006 get DEC2005, if today is Feb 16 2006, +
       get FEB2006 */

    CALLPRC PRC(CEELOCT) PARM(&LILIAN &NOTUSED1 &NOTUSED2 *OMIT)
    CHGVAR VAR(%BIN(&LILIAN)) VALUE(%BIN(&LILIAN) - 15)
    CALLPRC PRC(CEEDATE) PARM(&LILIAN 'MMMYYYY' &LIBNAME *OMIT)

    /* Create the "End of Month" library */

    CRTLIB LIB(&LIBNAME)

ENDPGM


I don't know precisely how the OP was planning to do the logic for figuring out the month (which is why I didn't post anything earlier). In my sample code, I assume that if you run this during the first 15 days of the month that you're running it for the previous month... but I don't know what the OP intended for that, I got lost trying to follow the logic in his text.

But, surely this doesn't qualify as "lengthy code"?!

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.