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

Compute difference between the current date is < 45


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Wed Jun 10, 2009 7:19 pm
Reply with quote

I have two files. First file has the current date mm/dd/yyyy

Second file is going to have random dates for a year in the same fromat .

mm/dd/yyyy
mm/dd/yyyy
so on

I need to select only those records from the second file for which the difference between the current date is < 45.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 10, 2009 10:43 pm
Reply with quote

cvishu,

You don't need a second file. you can directly use DATE1 in sort which gives you the current date in yyyymmdd format. Assuming your input is FB 80 bytes and your date field is in pos 1, the following JCL will give you the desired results. Just put your input date in yyymmdd format at pos 81 using inrec and we will use that to compare it against current date - 45 days

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                       
06/10/2009                           
03/10/2009                           
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  SORT FIELDS=COPY                   
  INREC OVERLAY=(81:7,4,1,2,4,2)     
  OUTFIL INCLUDE=(81,8,CH,LT,DATE1-45),BUILD=(1,80)
/*                                   
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Thu Jun 11, 2009 11:27 am
Reply with quote

Skolusu Thanks for ur response...

No i need to have the date in a seperate file, because its not going to be a normal date.. its bussiness date and may differe from the current date..
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 11, 2009 9:35 pm
Reply with quote

cvishu,

Sort products do NOT have the capability of getting relative dates from any given date.

If business day meant Mon - Fri, then we can check that subtract days appropriately from it.

For example if you are running on MON-THU we subtract 45 days, if we are running on SAT we subtract 46 days and if are running on Sunday we subtract 47 days. Let me know if you are interested in this procedure and I will show you a way to do it
Back to top
View user's profile Send private message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Thu Jun 11, 2009 9:42 pm
Reply with quote

Thanks i would like to try this method.. so that on any weekends i shuld still maintain the correct difference
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 11, 2009 10:05 pm
Reply with quote

cvishu,

use the following JCL

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYMNAMES DD *                                                   
WKDAY,S'&LWDAY'                                                   
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
06/10/2009                                                         
03/10/2009                                                         
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:7,4,1,2,4,2,WKDAY,DATE1-45)),
  IFTHEN=(WHEN=(89,3,CH,EQ,C'SAT'),OVERLAY=(92:DATE1-46)),         
  IFTHEN=(WHEN=(89,3,CH,EQ,C'SUN'),OVERLAY=(92:DATE1-47))         
  OUTFIL BUILD=(1,80),INCLUDE=(81,8,CH,LT,92,8,CH)                 
/* 
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
Search our Forums:

Back to Top