|
Using a couple of CEE APIs you can get your filename directly. This is an ILE program. pgm DCL &DATE *CHAR 6 DCL &LILDATE *CHAR 4 DCL &FC *CHAR 12 dcl &monthyear *char 7 /* get system date */ rtvsysval qdate &date /* change to first of month */ CHGVAR &DATE (%SST(&DATE 1 2) *CAT '01' *CAT %SST(&DATE 5 2)) /* get "lillian" date number */ CALLprc CEEDAYS (&DATE 'MMDDYY' &lildate &fc) /* subtract 1 day to get last day of previous month */ CHGVAR (%BIN(&LILDATE)) ((%BIN(&LILDATE) - 1)) /* get 3-char month name + 4-digit year */ CALLprc CEEDATE (&lildate 'MMMYYYY' &monthyear &fc) endpgm -------------- Original message -------------- From: Booth Martin <booth@xxxxxxxxxxxx> > In CL you know today's year and today's month. The day is always "1". > > Subtract 1 day from that date and you will have the last day of last month. > > You can do a CVTDAT command and get a julian date in the form of yyddd. > Subtract 1 and then do a cvtdat back to the date format you want. > > I leave it as a trivial problem to resolve a ddd of 000, which will > occur with this solution every January. > > John Candidi wrote: > > Let me describe what I'm trying to do. I'm sure it's pretty simple for > > anyone who knows CL. > > > > > > > > I need to create a library with the month-end name (i.e. after January > > month-end, I'd need a JAN2006 library) that will contain 10 files which I > > copy into it. I will need to do this every month as part of our month-end > > process. I assume it will have to subtract several days from today's date > > and pull the month and year from that date in case month-end is not run on > > the last day of the month Is there a simple CL program to do this. > > > > > > > > John A Candidi > > > > Rutgers Insurance Companies > > > > IT Director - AS/400 Manager > > > > 856-779-2274 > > > > > > > > > > > > -- > ----------------------------------- > Booth Martin > http://martinvt.com > ----------------------------------- > -- > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.