Page 1 of 1

Any way to pass the DATE to the SORT

PostPosted: Tue Mar 22, 2011 1:58 am
by Irene Ioujanina
Is there any way to pass the DATE to the SORT ?
I need to select the records with the yesterday's date.
Let's say, there is a huge file which includes the data for the whole year. Each record has a date like '2011-02-28' in the pos 1 thru 10. So to select the records for just one day (and it is always for yesterday's date) the SYSIN will look similar to
INCLUDE COND=(1,10,CH,EQ,C'2011-03-20')

Is any way to make '2011-03-20' be a result of the function, which let's say returns the todays date ?

Irene

Re: Any way to pass the DATE to the SORT

PostPosted: Tue Mar 22, 2011 6:36 am
by Frank Yaeger
If you want today's date, you can use a DFSORT INCLUDE statement like this:

  INCLUDE COND=(1,10,CH,EQ,DATE1(-))


If you want yesterday's date, you can use a DFSORT INCLUDE statement like this:

  INCLUDE COND=(1,10,CH,EQ,DATE1(-)-1)


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: Any way to pass the DATE to the SORT

PostPosted: Thu Mar 24, 2011 7:23 pm
by Irene Ioujanina
Thank you so much, Frank, for all your help!
I'm going to take a look at the tutorial.