>>>I can calculate the date difference by hand (in C based off of the 
character representation of the date) of course.  Unless someone knows of 
a nifty method to get the elapsed number of days from the data that I 
have?

Janet,

DFSORT is quite capable of calculating the date differences between 2 
dates.  DATEDIFF can be used to calculate the number of days between two 
date fields. 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).

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=* 
//SORTIN   DD * 
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
1972/01/01    1972/01/03 
//SORTOUT  DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  INREC IFOUTLEN=80, 
  IFTHEN=(WHEN=INIT, 
  OVERLAY=(81:01,10,UFF,M10,LENGTH=8,    $ START CCYY/MM/DD TO CCYYMMDD
           90:15,10,UFF,M10,LENGTH=8)),  $ END   CCYY/MM/DD TO CCYYMMDD
  IFTHEN=(WHEN=INIT, 
  OVERLAY=(30:90,8,Y4T,DATEDIFF,81,8,Y4T))  $ DATE DIFFERENCE 
//* 

The output from this job is 

1972/01/01    1972/01/03     +0000002

Further if you have any questions please let me know

Thanks.
Sri Hari Kolusu
DFSORT Development
IBM Corporation




From:   Janet Graff <[email protected]>
To:     [email protected]
Date:   06/12/2015 07:39 AM
Subject:        Re: STCK question
Sent by:        IBM Mainframe Discussion List <[email protected]>



As these things go, I have found new uses for my little routine.  It's 
strong enough to find the elapsed time for larger numbers than I intended. 
 So much so, I thought I'd add a function to show the elapsed time since 
the beginning of my started task.  The time is working wonderfully but 
when I cross the more than a day boundary I'd like to display the number 
of days since the start of the program.

I wound up using the 

STCK-STCK          difference in times since the start of the started task
+ 1972/01/01     add in base STCK time to get a STCK value again
STCKCONV           convert that to DATE=YYYYMMDD TIME=DEC
ED                       make it character based

sequence so I have

1972/01/03 23:15:06.238744

What I'd like is

2 days 23:15:06.238744

I can calculate the date difference by hand (in C based off of the 
character representation of the date) of course.  Unless someone knows of 
a nifty method to get the elapsed number of days from the data that I 
have?

Janet

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN



----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to