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

Selecting records less that current date


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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 Developer


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

PostPosted: Fri Jan 18, 2008 1:51 am
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
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 Developer


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

PostPosted: Sun Jan 20, 2008 5:51 am
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
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 Developer


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

PostPosted: Mon Jan 21, 2008 9:16 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
Search our Forums:

Back to Top