I've a senario, In that i need to extract last 7 days details using query in AS/400. I tried with MAX function. In that it takes MAX(&CURNTDATE) as whole number and subtract. For example i'm subtracting 7 from today's date (1101027 - 7), i got 1101020. If i subtract 40 means i got 1100987. Can anybody advice me to how to solve this.