Delete from LIBXXX/testB where orddtb<=080917 . The above code compare the date as numeric comparison. But I want date comparison. orddtb is declared as (6P 0). Please help me to compare numeric field date with real date. So that I can process the records. That Date field should be dynamic which depends upon the database I've read.(It may be like MMDDYY or DDMMYY or YYMMDD). I am using the query inside SQLRPGLE program.