Selecting by Date Logic
Posted: Thu Mar 22, 2012 9:14 pm
I am trying to set up a job that will run at various times during the year and needs to select only records that have a certain date field that has been modified in the last 4 years. I would like to set this up so that the include paramater will not have to be changed every time the job runs. Here is some sample data: (Date field is in MMDDYY format in columns 13-18)
JOHN DOE 052711
ANN JONES 072109
ED DAVIS 032508
BILL SMITH 121507
If my job ran today (03/22/2012), I would like it to pick up the first 3 records but not the last record. If this job runs on April first of this year (04/01/2012), I would like it to pick up just the first 2 records since record 3 would then be more than 4 years old.
I can use the following INCLUDE card to do this selection today, but then I would have to change it on April first to then not pick up the third record:
INCLUDE=((17,2,CH,GT,C'07'),OR,(17,2,CH,EQ,C'07',AND,13,4,CH,LE,C'0322'))
Can anyone find a way to do this without having to change the hard-coded year (07) and/or the hard-coded month and day (0322)?
Thanks.
JOHN DOE 052711
ANN JONES 072109
ED DAVIS 032508
BILL SMITH 121507
If my job ran today (03/22/2012), I would like it to pick up the first 3 records but not the last record. If this job runs on April first of this year (04/01/2012), I would like it to pick up just the first 2 records since record 3 would then be more than 4 years old.
I can use the following INCLUDE card to do this selection today, but then I would have to change it on April first to then not pick up the third record:
INCLUDE=((17,2,CH,GT,C'07'),OR,(17,2,CH,EQ,C'07',AND,13,4,CH,LE,C'0322'))
Can anyone find a way to do this without having to change the hard-coded year (07) and/or the hard-coded month and day (0322)?
Thanks.