I have a file which has transaction details in DB2 and my requirement is extract last 1 months transaction data. Currently I amend the date range manually as bellow.
How about using current date and date arithmetics?
current date
WHERE TRAN_DATE BETWEEN current date and (current date - 1 month)
If you need the YYYYMMDD format, you can convert like this:
YYYYMMDD
YEAR(CURRENT DATE) * 10000 + MONTH(CURRENT DATE) * 100 + DAY(CURRENT DATE)