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
 

 

Selecting records less that current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Jan 17, 2008 11:33 pm    Post subject: Selecting records less that current date
Reply with quote

I have an FB/80/27920 dataset:

Code:

ABCDE 2007-12-15
DEFGH 2008-01-14
QRSTU 2008-08-06
IJKLM 2007-10-02
NOPQR 2008-06-18


The date is in position 7 in a yyyy-mm-dd format

How would I write an INCLUDE statement to select records whose date is less than current date?
Back to top
View user's profile Send private message

Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Jan 18, 2008 12:52 am    Post subject: Reply to: Selecting records less that current date
Reply with quote

Try these control statements in your SYSIN:

Code:
//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  INCLUDE COND=(1,10,CH,LT,DATE4)     
/*                                     
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Jan 18, 2008 1:01 am    Post subject:
Reply with quote

Hi,

I should have used INCLUDE COND=(7,10,CH,LT,DATE4) as the date starts in position 7.


Regards,
Ganesh
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Fri Jan 18, 2008 1:16 am    Post subject: Reply to: Selecting records less that current date
Reply with quote

Thank you for your assistance. The solution worked perfectly.

Scott
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Jan 18, 2008 1:51 am    Post subject:
Reply with quote

Hmmm

Really, a better (more general) choice would be:

Code:

  INCLUDE COND=(7,10,CH,LT,DATE1(-)) 


which generates a 10-byte 'yyyy-mm-dd' date.

Code:

   INCLUDE COND=(7,10,CH,LT,DATE4)


will work for a yyyy-mm-dd date, but not for a date with any other separation character. DATE4 actually generates a 19-byte date in the form 'yyyy-mm-dd-hh.mm.ss'. 1,10 results in only using the first 10 bytes of that date. And there's no way to use another separation character with DATE4, so it wouldn't work for a 'yyyy.mm.dd' date, for example.

DATE1(-) generates a 10-byte date in the form 'yyyy-mm-dd. DATE(.) generates a 10-byte date in the form 'yyyy.mm.dd'. And so on. So DATE1(c) is really the more general choice and avoids the overhead of truncating the constant to the field length.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Sat Jan 19, 2008 10:39 am    Post subject: What is the case if the date is not in that YYYY-MM-DD form
Reply with quote

Hi Frank,

Here we are comparing the Dates in the file with the CURRENT DATE.

But In case IF we want to compare the date like 2007-06-15, then how will be the sort card. where do we need to store the date 2007-06-15.

and what is the case if the date is in YYMMDD and we want to compare these dates coming from the input file with the 2007-06-15 date format.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Jan 20, 2008 5:51 am    Post subject:
Reply with quote

You say "where do we need to store the date 2007-06-15". Are you trying to avoid "storing" it in the INCLUDE statement as a constant?

Code:

   INCLUDE COND=(p,m,f,EQ,C'date')


You could store it in a file as a DFSORT symbol:

MYDATE,'2007-06-15'

and use that symbol in the INCLUDE statement:

Code:

//SYMNAMES DD DSN=...
...
//SYSIN DD *
   INCLUDE COND=(p,m,f,EQ,MYDATE)


or store just the date in a file, and use DFSORT to create a DFSORT symbol from that file (I've shown many examples of this).

If you want to compare it to a YYMMDD date, why wouldn't you "store" it as a YYMMDD date instead of as a 'YYYY-MM-DD' date? If you need to store it as a 'YYYY-MM-DD' date, you could use DFSORT to create a YYMMDD date from it.

If that doesn't help, please explain more clearly what is you want to do exactly.
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Mon Jan 21, 2008 12:55 pm    Post subject: Reply to: Selecting records less that current date
Reply with quote

Can u pls explain how to store that date with code..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jan 21, 2008 9:16 pm    Post subject:
Reply with quote

Quote:
Can u pls explain how to store that date with code..


I don't know what you mean by this.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jan 21, 2008 10:00 pm    Post subject:
Reply with quote

mkk157
Guess you are looking for this!!
Code:
INCLUDE COND=(7,10,CH,LT,C'2007-12-15') 
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
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
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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