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
 

 

Number of years the records is present in the file.

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

New User


Joined: 14 Mar 2008
Posts: 74
Location: India,Chennai

PostPosted: Thu Oct 16, 2008 3:32 pm    Post subject: Number of years the records is present in the file.
Reply with quote

Hi all,
I have a requirement in which i have to find the number of years the records are present in the file(from current date). Each record will have a date in the first 10 bytes (mm/dd/yyyy).This date corresponds to when the record was written in the file.The date might vary for each record. I need to find how many years each record is present in the file.

Input file details:
Length : 50 bytes (10 bytes date + 40 bytes data)

Sample record:
10/12/2005.....40 bytes data....

Expected output:
Length: 58 bytes (50 bytes data + 08 bytes date (difference date)) I have to use system date to find the difference date.
difference date format -- yyyymmdd.
Sample o/p record:
50 bytes i/p record..00071002
here '0007' corresponds to number of years the record was present in file.
'10' corresponds to number of months and '02' corresponds to number of days.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Thu Oct 16, 2008 9:45 pm    Post subject: Reply to: Number of years the records is present in the file
Reply with quote

passion_sujesh,

Sort products do not have the ability to calculate the difference between 2 dates as requested by you
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Nov 02, 2010 4:27 am    Post subject:
Reply with quote

passion_sujesh,

With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can be used to calculate the number of days difference between two dates. The result is an 8-byte value consisting of a sign and 7 digits (sddddddd). If the first date is greater than or equal to the second date, the sign is + (plus). If the first date is less than the second date, the sign is - (minus).


Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
----+----1----+----2----+----3----+----4----+----5----+----6---
10/12/2005.....40 BYTES DATA....                               
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFOUTLEN=58,                                           
  IFTHEN=(WHEN=INIT,BUILD=(1,50,DATE1,1,10,UFF,M11,LENGTH=8)),
  IFTHEN=(WHEN=INIT,OVERLAY=(51:51,8,Y4T,DATEDIFF,59,8,Y4W))   
//*


The output from the above job is

Code:

10/12/2005.....40 BYTES DATA....                  +0001846


For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
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 Sort Card to Remove Duplicate records... raj4neo SYNCSORT 0 Wed Jan 25, 2017 4:44 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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