I have one file with the two fileds have timestamp .I need to compare the both dates (date format is YYYY/MM/DD), If the date difference is more than one day I need to write one file otherwise I need to write into another file .
I don't know any function within DFSort to do the date difference directly. Since you haven't yet given your DFSort function level, I am assuming you have the latest PTF available...
Check if below works for you...
//STEP01 EXEC PGM=SORT
//SYSOUS DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD YOUR INPUT FILE
//OUT DD YOUR DATE DIFF. OF 1 FILE
//SAVE DD YOUR REMAINING RECORDS FILE
//SYSIN DD *
However, using cobol, it gets less complicated. Below is a cobol logic for the same.
COMPUTE WS-CCYYMMDD-N1 = FUNCTION
INTEGER-OF-DATE(WS-CCYYMMDD1) --> your first date field
COMPUTE WS-CCYYMMDD-N2 = FUNCTION
INTEGER-OF-DATE(WS-CCYYMMDD2) --> your second date field
With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can be used to calculate the number of days difference between two dates. The result is an 8-byte value consisting of a sign and 7 digits (sddddddd). If the first date is greater than or equal to the second date, the sign is + (plus). If the first date is less than the second date, the sign is - (minus).