how to use year function in cobol-db2
Posted: Tue Nov 09, 2010 8:21 pm
in my program i have to calculate the no. of years between two dates ie.,current date and a another date stored in a working storage variable
but wn iam using
exec sql
select year( current_date - :ws-date )
into :ws-year
from sysibm.sysdummy1
end-exec
*01 ws-date pic x(10) value '1990-10-13'
01 ws-year pic x(10).
its not working...so someone suggest me the correct data types and format for the date variables and syntax for the above query
but wn iam using
exec sql
select year( current_date - :ws-date )
into :ws-year
from sysibm.sysdummy1
end-exec
*01 ws-date pic x(10) value '1990-10-13'
01 ws-year pic x(10).
its not working...so someone suggest me the correct data types and format for the date variables and syntax for the above query