Hello Everybody. I am working with DB2 Version 7 for OS/390.
I need an scalar function with the next conditions:
- Parameter: Char (10)
Contains a date in format 'YYYY-MM-DD'
- Result: Decimal (7)
Value is PPPPNNN where
PPPP = (YYYY + 1) if MM > 06, else PPPP = YYYY
NNN = Days transcurred from the last Jun-30 before parm dt
To illustrate the requirement, 2 examples:
Parm date: '2003-12-01' , Result: 2004154 (154 days from 2003-06-30)
Parm date: '2004-05-30' , Result: 2004335 (335 days from 2003-06-30)
I coded the function, but I think my version is a little complex.
Your help will be appreciated.
Thanks, Aloz.