Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to filter out data by date using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: How to filter out data by date using DFSORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Feb 20, 2013 12:38 pm    Post subject: Reply to: How to filter out data by date using DFSORT
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    Post subject: Reply to: How to filter out data by date using DFSORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Feb 20, 2013 1:07 pm    Post subject: Reply to: How to filter out data by date using DFSORT
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Feb 20, 2013 1:16 pm    Post subject:
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    Post subject: Reply to: How to filter out data by date using DFSORT
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Wed Feb 20, 2013 2:40 pm    Post subject: Reply to: How to filter out data by date using DFSORT
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    Post subject: Reply to: How to filter out data by date using DFSORT
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: 8593
Location: Back in jolly old England

PostPosted: Wed Feb 20, 2013 3:19 pm    Post subject:
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    Post subject: Reply to: How to filter out data by date using DFSORT
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us