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

Need help in finding defference between two dates


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

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu Jan 10, 2013 5:08 pm
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: 184
Location: India

PostPosted: Thu Jan 10, 2013 5:14 pm
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

Global Moderator


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

PostPosted: Thu Jan 10, 2013 5:19 pm
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: 184
Location: India

PostPosted: Thu Jan 10, 2013 5:30 pm
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

Global Moderator


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

PostPosted: Thu Jan 10, 2013 5:35 pm
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
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: 184
Location: India

PostPosted: Fri Jan 11, 2013 7:37 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Finding and researching jobs All Other Mainframe Topics 0
No new posts VB to FB - Finding LRECL SYNCSORT 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Finding faulty logic Subscript out of... COBOL Programming 5
Search our Forums:

Back to Top