MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Extract a record based on date range

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
gps_94
Beginner


Joined: 03 Aug 2018
Posts: 4
Topics: 2

PostPosted: Mon Feb 04, 2019 7:28 pm    Post subject: Extract a record based on date range Reply with quote

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
Back to top
View user's profile Send private message
gps_94
Beginner


Joined: 03 Aug 2018
Posts: 4
Topics: 2

PostPosted: Mon Feb 04, 2019 7:46 pm    Post subject: Reply with quote

Below is the data looks like from position 75.

+----8----+----9----+----0----+----1----+----2----+----3
********************************* Top of Data **********
,TEST,2006-11-06,06:00:00,2006-11-06,09:20:00, 1, 0
,TEST,2006-11-06,06:00:00,2006-11-06,09:58:00, 1, 0
,TEST,2006-11-06,06:00:00,2006-11-06,12:08:00, 1, 0
,TEST,2006-11-06,06:00:00,2006-11-06,12:19:00, 1, 0
,TEST,2006-11-06,06:00:00,2006-11-06,13:05:00, 1, 0
_________________
Mainframe Developer
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Feb 05, 2019 6:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Tue Feb 05, 2019 9:12 am    Post subject: Reply with quote

gps 94,
Please code tags for readability:
Code:
+----8----+----9----+----0----+----1----+----2----+----3
 ********************************* Top of Data **********
 ,TEST,2006-11-06,06:00:00,2006-11-06,09:20:00, 1, 0
 ,TEST,2006-11-06,06:00:00,2006-11-06,09:58:00, 1, 0
 ,TEST,2006-11-06,06:00:00,2006-11-06,12:08:00, 1, 0
 ,TEST,2006-11-06,06:00:00,2006-11-06,12:19:00, 1, 0
 ,TEST,2006-11-06,06:00:00,2006-11-06,13:05:00, 1, 0

Click the Code button, key (or paste) your data, click on the Code button again, Preview, and Submit when satisfied.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Feb 05, 2019 12:15 pm    Post subject: Reply with quote

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

https://www.mvsforums.com/helpboards/viewtopic.php?p=19031#19031

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

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group