Generate a list of dates on the iSeries

In case you don’t have a date/calendar dimension to work off of.

 

WITH DATELIST (DATEVAL) AS (
  SELECT
    CURRENT DATE AS DATEVAL
  FROM SYSIBM.SYSDUMMY1

  UNION ALL

  SELECT
    (DATEVAL + 1 DAYS) AS DATEVAL
  FROM DATELIST
  WHERE DATEVAL < (CURRENT DATE + 100 DAYS)
)
SELECT
  *
FROM
  DATELIST;