Diff between Timestamp
-
- Posts: 22
- Joined: Thu Mar 04, 2010 12:12 am
- Skillset: DB2 , COBOL , JCL , PL1 , IMS , VSAM
- Referer: google
Diff between Timestamp
Hi. How to get the difference between two timestamp in PL/I??
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Diff between Timestamp
Are these DB2 timestamps?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Posts: 22
- Joined: Thu Mar 04, 2010 12:12 am
- Skillset: DB2 , COBOL , JCL , PL1 , IMS , VSAM
- Referer: google
Re: Diff between Timestamp
yes.. Its DB2 Timestamp only. but i need to check in my pli program .
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Diff between Timestamp
I think you can use the DAYS builtin function - convert both, subtract and then another BIF (same section of the manual) to convert the result back to time. Something like
diff = days(ts1) - days(ts2)
ans = ????(diff)
diff = days(ts1) - days(ts2)
ans = ????(diff)
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
- prino
- Posts: 641
- Joined: Wed Mar 11, 2009 12:22 am
- Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
- Referer: Google
- Location: Vilnius, Lithuania
- Contact:
Re: Diff between Timestamp
NicC wrote:I think you can use the DAYS builtin function - convert both, subtract and then another BIF (same section of the manual) to convert the result back to time. Something like
diff = days(ts1) - days(ts2)
ans = ????(diff)
Don't "think you can use", if you had RFTM, you would have known that the DAYS builtin is useless for DB2 timestamps, none of the PL/I builtin functions supports the "YYYYMMDDHHMISS999999" format of DB2 timestamps!
You need extended float (i.e. FLOAT DEC (33), or FLOAT DEC(34) for DFP)) to cater for the full range of self-calculated microseconds, unless you split it in date and time parts, in which case you still have to handle the micro-second part yourself!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
robert.ah.prins @ the.17+Gb.Google thingy
-
- Global moderator
- Posts: 3025
- Joined: Sun Jul 04, 2010 12:13 am
- Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
- Referer: Google
- Location: Pushing up the daisies (almost)
Re: Diff between Timestamp
Good catch - I only glanced at the manual. One can always drop off the microseconds unless it is so really important but that is the analyst's call.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
Regards
Nic
-
- Similar Topics
- Replies
- Views
- Last post
-
- 3
- 2704
-
by engh
View the latest post
Mon Jan 09, 2023 2:23 pm
-
-
Can anyone tell me how to retrieve the vsam system timestamp
by jdechirico » Tue Jun 18, 2024 9:22 pm » in VSAM/SMS - 1
- 1545
-
by enrico-sorichetti
View the latest post
Tue Jun 18, 2024 10:06 pm
-