Posted: Mon Feb 04, 2019 7:28 pm Post subject: Extract a record based on date range
Hi,
I have a below requirement:
File Length: 160
Start Date field starts at position 81 (YYYY-MM-DD) and stop date starts at position 101 (YYYY-MM-DD)
I need to extract the records for data missed for 21st Nov 2018
So conditions would be :
Records which has Start Date as 2018-11-21 or
Records which has Stop Date as 2018-11-21 or
Records with this date (2018-11-21) which can fall between any date range for example
Start date 2018-01-01 and Stop Date 2018-12-05
How can I achieve it through DFSORT. _________________ Mainframe Developer
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Tue Feb 05, 2019 6:23 am Post subject:
Please do not post on multiple forums at the same time. Your topic on another forum will be deleted. _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Tue Feb 05, 2019 12:15 pm Post subject:
gps_94,
Please do not post the questions across multiple helpboards. Pick a board of your choice (I don't care if it is a competitor board) and if you do not get the answer within reasonable time (8 hours min) then only you can post on this board.
Please use code tags which makes the data readable and retains the spacing. Terry Heinze has shown you how to use code tags. Also check this link which explains in detail about using code tags
Assuming your start and stop dates are all Valid dates then you can use UFF format to filter the records. If you have invalid stop dates (ex: 20180230) then those records will also be picked. However you can perform validation on such records and remove them in the same pass. You just need to use INREC or OUTREC and then have another INCLUDE on OUTFIL to filter the invalid records.
Code:
//SYSIN DD *
OPTION COPY
INCLUDE COND=(081,10,UFF,EQ,20181121,OR, $ START-DATE=2018-11-21
101,10,UFF,EQ,20181121,OR, $ STOP-DATE=2018-11-21
(081,10,UFF,EQ,20181121,AND, $ START-DATE=2018-11-21
101,10,UFF,LE,20181121)) AND STOP-DATE<=2018-11-21
//*
_________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum