My Job runs on first Sunday of every month. It extracts the data from database for the last month. I need to FTP the files created with file name appended with previous month name.
Say for example,
If my Job ran on June 4th, then file name should be like 'xxxx.xxx.xxx.May2010' or 'xxxx.xxx.xxx.May'.
Please let me know how previous month can be fetched from current date.
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
Well, of course, the variable MNTH is assigned to the value of the system variable &LMON, and the variable YEAR is assigned to the value of the system variable &LYR4.
First, the input record gets overlaid with the value of the current month number (MNTH) in column 8 and the current year (YEAR) in column 4.
Next, column 1 gets the value of column 8 less one. If the resulting value is 00 (so the current month is January), overlay the value of 'DEC' to column 1, and overlay the value of the current year less one.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
ashok_ma,
Here is an alternative way of getting the desired results. DATE2 is C'yyyymm' format of current date and subtracting 1 gives you the last month and using FINDREP we change the numeric month name to alphabetic month name.