IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to filter out data by date using DFSORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Tushar Dhadiwal

New User


Joined: 29 Aug 2011
Posts: 7
Location: Pune

PostPosted: Wed Feb 20, 2013 12:13 pm
Reply with quote

I have a flat file with some useful data along with timestamp on each record. Inorder to create a report, I need data of that Week ONLY for my further analysis. I need to filter out that week's data using DFSORT. Hope my question is clear.

Thanks and Regards,
Tushar Dhadiwal
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 20, 2013 12:38 pm
Reply with quote

Which "week". Have you looked at the date functions in the manual?

If you use INCLUDE/OMIT for the date range that you want, you should get the data you want.
Back to top
View user's profile Send private message
Tushar Dhadiwal

New User


Joined: 29 Aug 2011
Posts: 7
Location: Pune

PostPosted: Wed Feb 20, 2013 12:51 pm
Reply with quote

for current week, for example if todays date is 20/2/2013 then i want the data of last 5 days. i written the sort like this but it is not working, giving the syntax error.

INCLUDE COND=(001,007,EQ,DATE2(-)-1)

can you please help on the same.

Thanks and Regards,
Tushar Dhadiwal
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 20, 2013 1:07 pm
Reply with quote

Can you please paste the fully SYSOUT showing the syntax error, in the Code tags?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Feb 20, 2013 1:16 pm
Reply with quote

Look at your input date format.

For date values in the form C'yyyy/mm/dd', you could use the DATE1(/) constant; for date values in the form C'yyyy-mm', you could use the DATE2(-) constant; for date values in the form P'yyyyddd', you
could use the DATE3P constant; and for date values in the form Z'yymmdd' (2-digit year date), you could use the Y'DATE1' constant.
Back to top
View user's profile Send private message
Tushar Dhadiwal

New User


Joined: 29 Aug 2011
Posts: 7
Location: Pune

PostPosted: Wed Feb 20, 2013 1:41 pm
Reply with quote

Input Data Format:2013-02-11-00.00.00.000000 1030101010 TUSHAR

Spool Sysout with error:

Code:
SYSIN :                                       
     SORT FIELDS=COPY                         
     OUTFIL FNAMES=SORTOUT,                   
           INCLUDE=(001,010,EQ,DATE3(-)-1)     
                             *                 
WER251A  INCLUDE/OMIT INVALID FORMAT           
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000 
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 20, 2013 2:40 pm
Reply with quote

You didn't specify the type of field.
Back to top
View user's profile Send private message
Tushar Dhadiwal

New User


Joined: 29 Aug 2011
Posts: 7
Location: Pune

PostPosted: Wed Feb 20, 2013 3:03 pm
Reply with quote

Thanks Bill and Peter... its working now.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Feb 20, 2013 3:19 pm
Reply with quote

Tushar Dhadiwal

Please be aware that you DO NOT use DFSORT
You use SYNCSORT
Back to top
View user's profile Send private message
satyapn9

New User


Joined: 08 Oct 2010
Posts: 27
Location: India

PostPosted: Fri Feb 22, 2013 9:22 pm
Reply with quote

Hi, Look at this, it may helps you.

I have sorted my file which has date field in the format mm/dd/yyyy. My requirement was to include/extract records which are dated between 02/28/2011 & 12/31/2011. File LRECL is 45 only. Below is the example how SORT options were used.

Code:
//*                                                           
//SYSIN    DD *                                               
         INREC OVERLAY=(46:26,4,20,2,23,2)                   
         SORT FIELDS=(46,8,CH,A)                             
                                                             
         OUTFIL BUILD=(1,45),                                 
         INCLUDE=(46,8,ZD,GE,20110228,AND,46,8,ZD,LE,20111231)
/* 
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Store the data for fixed length COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top