|
View previous topic :: View next topic
|
| Author |
Message |
satyapn9
New User

Joined: 08 Oct 2010 Posts: 27 Location: India
|
|
|
|
Can you please let me know how to extract the records within date range like (02/28/2011 to 12/01/2014).
Thanks,
Satya Prasad Nimmakayala. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You need to review some other similar topics and provide the necessary information. . .
Show a bit of sample input and the output you want from that input. Mentoin the recfm and lrecl of the files. Show the data potisions within the records you want to use for selecting data. If there are any rules (other than the date selection) post these. |
|
| Back to top |
|
 |
satyapn9
New User

Joined: 08 Oct 2010 Posts: 27 Location: India
|
|
|
|
Hi Scherrer,
Thank you for the update.
I have coded one sort card with INCLUDE and OMIT conditions and worked but; it was a bit lengthy;
So I wanted to know if we have any SORT Utility Function that could sort the file within the date ranges. It would be easier if we have a function like this to sort based on dates.
In my file -->each record contains the date values like "02/28/2011" from the position 20 to 29 ( with slashes). |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| I have coded one sort card with INCLUDE and OMIT conditions and worked but; it was a bit lengthy; |
As you have not posted your "sort card", no one can offer any kind of improvement suggestion. . .
The most important part of getting help here is providing proper nformation. If you are unwilling/unable to do this, you will find your topics drag on and on - eventually being locked if they completely stall.
| Quote: |
| It would be easier if we have a function like this to sort based on dates. |
Suggest you submit a product enhancement request. |
|
| Back to top |
|
 |
satyapn9
New User

Joined: 08 Oct 2010 Posts: 27 Location: India
|
|
|
|
Hi Dick Scherrer,
Sorry for not posting exact information you have asked me to post.
Below is the Sort job I've written and worked for the date range ( 02/28/2011 to 12/31/2011). But actually i want a generic function that could sort the given date range.
***************************************
| Code: |
//SORTIN DD DISP=SHR,
// DSN=FITPRO.DZZ3850.CERTFUTR.G4811V00
//SORTOUT DD DSN=TEST.TST.DZZ3850.CERTFUTR.G4811.NEW,
// UNIT=(DISK,22),SPACE=(CYL,(200,200),RLSE),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=(20,10,CH,A)
INCLUDE COND=((1,03,CH,EQ,C'HMO'),AND,
(20,02,CH,GE,C'02'),AND,
(26,04,CH,GE,C'2011'),AND,
(26,04,CH,LT,C'2012'))
/*
//*
//STEP11 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,
// DSN=TEST.TST.DZZ3850.CERTFUTR.G4811.NEW
//SORTOUT DD DSN=TEST.TST.DZZ3850.CERTFUTR.G4811,
// UNIT=(DISK,22),SPACE=(CYL,(200,200),RLSE),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=(20,10,CH,A)
OMIT COND=((20,02,CH,EQ,C'02'),AND,
(23,02,CH,LT,C'28'))
/*
//* |
************************************
In the above I have written two steps; one for INCLUDE and one for OMIT.
Is there any otherway that would simplify the code? |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
satyapn9,
Sorting a date in (mm/dd/ccyy) format as a character string is not going sort them date wise ascending. You need to sort on CCYY first followed by MM followed by DD.
Assuming your input lrecl is 80 and recfm=fb, the following DFSORT control cards will give you the desired results. We first overlay the date in CCYYMMDD format at the end of the every record and sort on that field. Using an include cond on OUTFIL we eliminate the unwanted records by checking the date in CCYYMMDD format.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4
PICK 02/28/2011
DROP 02/27/2011
DROP 12/02/2014
PICK 12/01/2014
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(81:26,4,20,2,23,2)
SORT FIELDS=(81,8,CH,A)
OUTFIL BUILD=(1,80),
INCLUDE=(81,8,ZD,GE,20110228,AND,81,8,ZD,LE,20141201)
//* |
|
|
| Back to top |
|
 |
satyapn9
New User

Joined: 08 Oct 2010 Posts: 27 Location: India
|
|
|
|
Hi Kolusu,
Thank you so much for your help. Ofcourse it is a delayed response from me.
It worked well and you are wonderful in giving the explanation. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|