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
 

 

Compute difference between the current date is < 45

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Compute difference between the current date is < 45
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Compute difference between the current date is <
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    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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


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