Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 161
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: 161
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: 1544
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: 161
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: 1544
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: 161
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 the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am
No new posts Finding difference between two PS fil... Vignesh Sid SYNCSORT 5 Mon Oct 30, 2017 1:13 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts Finding IMS resource blocker after se... Hooman24 IMS DB/DC 1 Wed Aug 16, 2017 9:17 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us