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
 
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 Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 3 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm

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