Page 1 of 1

Compare Dates in SORT

Posted: Tue Sep 15, 2015 3:23 pm
by Mr Awasthi
All,

I have a got a file in which one of the columns will have the dates in the MM/DD/YYYY.

Code: Select all

11/25/2015 
10/10/2015 
10/12/2015 
06/29/2015 
09/21/2015 
10/30/2015 
09/12/2015 
08/20/2015 
07/16/2015 
09/27/2015 
04/15/2010 
10/14/2015 
09/20/2015 
I need to get only those records which are older than today date. I used the following control statements.

Code: Select all

SORT FIELDS=COPY                            
INCLUDE COND=(1,10,LT,&DATE(MD4/)),FORMAT=ZD 
OUTREC FIELDS=(1,30)
but it gives a syntax error. Can someone please help me to correct it.

Re: Compare Dates in SORT

Posted: Tue Sep 15, 2015 4:20 pm
by William Collins
Perhaps you should look up what &DATE is and where it can be used?

Re: Compare Dates in SORT

Posted: Tue Sep 15, 2015 5:37 pm
by Anuj Dhawan
It's been a while when I used SORT but try with this, assuming your Input FB/80 (not teste):

Code: Select all

//SYSIN    DD *                                                    
  SORT FIELDS=COPY                                                  
  INREC OVERLAY=(81:7,4,1,2,4,2,DATE1)                              
  OUTFIL BUILD=(1,80),INCLUDE=(81,8,CH,LT,89,8,CH)                  
//*