|
Exactly right. Since the question was for CL I responded in CL. CLLE can do many things with less code but I'm still investigating it. Thanks for the example of how it should be done. I was thinking of trying to follow through all the IF statements if you don't use procedure calls. -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement Sent: Monday, January 30, 2006 4:41 PM To: Midrange Systems Technical Discussion Subject: RE: CL program 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 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.