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
 

 

Need help in finding defference between two dates

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

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Thu Jan 10, 2013 5:08 pm    Post subject: Need help in finding defference between two dates
Reply with quote

Hi All,

I am trying to find the difference between two date fields. I am able to get the value but I am not able to exclude input records if any of the date is zeros.

I am using following sort card
Code:

SORT FIELDS=COPY                                 
OUTREC IFTHEN=(WHEN=(10,8,CH,NE,C'00000000',AND,
                     18,8,CH,NE,C'00000000'),   
       BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T))     


Below is the test data. I do not want to process 2nd and 5th record because any of the date field is zero.

Code:

----+----1----+----2----+
AJAKLFJJL2013010120130105
SDAFSDASL2013010100000000
CXVGSDFJL2013010120130105
ERYKLFJJL2013010120130105
UREYLFJJL0000000020130105
MHGGFJJJL2013010120130105
TYIRTFJJL2013010120130105


Can anyone help me in this regard.

Thanks,
Satish
Back to top
View user's profile Send private message

satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Thu Jan 10, 2013 5:14 pm    Post subject:
Reply with quote

Hi All,

Just to inform you that I am getting my desired output using below sort card.

Code:
SORT FIELDS=COPY                           
OUTFIL INCLUDE=(10,8,CH,NE,C'00000000',AND,
                18,8,CH,NE,C'00000000'),   
       IFTHEN=(WHEN=INIT,                   
       BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T))


Many thanks..!!

Thanks,
Satti
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Jan 10, 2013 5:19 pm    Post subject:
Reply with quote

Please explain your problem better

What is the expected output before I start guessing it wrong?

Please also show the expected output withing codetags
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Thu Jan 10, 2013 5:30 pm    Post subject:
Reply with quote

Hi Pandora,

Below is my input:
Code:
----+----1----+----2----+
AJAKLFJJL2013010120130105
SDAFSDASL2013010100000000
CXVGSDFJL2013010120130105
ERYKLFJJL2013010120130105
UREYLFJJL0000000020130105
MHGGFJJJL2013010120130105
TYIRTFJJL2013010120130105


Date1 starts at 10th position and is in CCYYMMDD format.
Date2 starts at 10th position and is in CCYYMMDD format.

I want to find the difference between Date2 and Date1 if the both the dates are not zeros.

Since Date2 is zero in second record I do not want to process. Also, 5th record since Date1 is zero.

So, my output file will contain 5 records

Code:

+0000004
+0000004
+0000004
+0000004
+0000004


Thanks!!
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Jan 10, 2013 5:35 pm    Post subject:
Reply with quote

Thanks icon_smile.gif

I was too fast to reply and just saw you solved it yourself icon_smile.gif

Also ensure the it is always 00000000 and not any other value so your card might not work as expected
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jan 11, 2013 5:08 am    Post subject:
Reply with quote

satish.ms10,

Here is a simplified version.

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                             
AJAKLFJJL2013010120130105                   
SDAFSDASL2013010100000000                   
CXVGSDFJL2013010120130105                   
ERYKLFJJL2013010120130105                   
UREYLFJJL0000000020130105                   
MHGGFJJJL2013010120130105                   
TYIRTFJJL2013010120130105                   
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                             
  OPTION COPY                               
  OMIT COND=(10,8,UFF,EQ,0,OR,18,8,UFF,EQ,0)
  INREC BUILD=(18,8,Y4T,DATEDIFF,10,8,Y4T)
//*
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 158
Location: India

PostPosted: Fri Jan 11, 2013 7:37 am    Post subject:
Reply with quote

Thanks a lot Kolusu,
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 Finding unreferenced datasets without... Alan Playford JCL & VSAM 5 Tue Jul 12, 2016 9:07 pm
No new posts Finding repetead surnames in differen... blackjack202 DFSORT/ICETOOL 7 Tue Jun 07, 2016 7:42 pm
No new posts Need help in Finding who changed the ... steve-myers JCL & VSAM 6 Wed Jan 27, 2016 9:01 pm
No new posts Finding a File Containing a Particula... rexx77 DFSORT/ICETOOL 8 Tue Dec 22, 2015 2:19 am
No new posts Sort Card : To get the records with ... pecsakthivel123 DFSORT/ICETOOL 7 Thu Dec 10, 2015 11:54 pm


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