View previous topic :: View next topic
|
Author |
Message |
Gaurav Bhayawala
New User
Joined: 17 Apr 2008 Posts: 14 Location: Pune
|
|
|
|
I have one time field in HHMMSSXX form & one Date field in Juian..
I want to get absolute time in X(15) form.
How can I get it...?
Here my confusion is, I don't know in which form TIMES & DATES should be there in absolute time field - X(15). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I've never heard of absolute time except in reference to CICS programs. As far as I know, there's no way in batch COBOL to get this field. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
all depends on the absolute time definition...
as far as cics is concerned her is the definition
Quote: |
specifies the data area for the time, in packed decimal, since 00:00 on 1 January 1900 (in milliseconds rounded to the nearest hundredth of a second). |
with the definitions
Code: |
COBOL: PIC S9(15) COMP-3
C char data_area[8];
PL/I: FIXED DEC(15)
ASM: PL8
|
in other word 8 bytes packed |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
Back to top |
|
|
Gaurav Bhayawala
New User
Joined: 17 Apr 2008 Posts: 14 Location: Pune
|
|
|
|
enrico-sorichetti,
I agree, it stores in Packed decimal (8 bytes).
But here as per my question if my date = 1st Jan 2008 (In Julian - 0012008)
& Time = 01:40:30:80 (in HH:MM:SS:XX)
Now I want this in Absolute form FINAL DATE in S9(15) COMP-3.
How it will be manage in this field |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
I gave You the link to the LE manual
a bit of ingenuity and a couple of reference modification moves should do it |
|
Back to top |
|
|
Gaurav Bhayawala
New User
Joined: 17 Apr 2008 Posts: 14 Location: Pune
|
|
|
|
Thanks enrico-sorichetti,
I have asked the second question before you sent me answer with attached link...So before posting it u may have sent the link...
So that has created confusion betweeen us...
Anyway thanks for your valuable help...
Regards,
Gaurav |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
First, you need to get the number of days between the Julian-Date and 01 January 1900.
This can be accomplished by subtracting FUNCTION INTEGER-OF-DAY(1900001) from FUNCTION INTEGER-OF-DAY(JULIAN-DATE), multiply this difference by 86400000 and
store it in a PIC 9(15) field, which is redefined as PIC X(15).
You must ensure that your JULIAN-DATE has a valid century before the above calculation, with a format of CCYYDDD.
To validate the JULIAN-DATE, you can call LE Callable Service routine "CEEDAYS" beforehand.
Date FUNCTION's in COBOL assume you are passing a valid date and will blow-up if this is not true.
Then, multiply the HH by 3600000, multiply the MM by 60000, multiply the SS by 1000 and multiply the XX (assuming this is TH) by 10 and add all of these calculated values to
the above PIC 9(15) field. The result will have a low-order display-numeric zero, representing the millisecond-portion.
You're done!
Code: |
COMPUTE WS-ABSTIME = (FUNCTION INTEGER-OF-DAY
(WS-JULIAN-DATE) -
FUNCTION INTEGER-OF-DAY
(1900001)).
COMPUTE WS-ABSTIME = (WS-ABSTIME * 86400000) +
(WS-TIME-HH * 3600000) +
(WS-TIME-MM * 60000) +
(WS-TIME-SS * 1000) +
(WS-TIME-TH * 10).
|
HTH....
Regards,
Bill |
|
Back to top |
|
|
Gaurav Bhayawala
New User
Joined: 17 Apr 2008 Posts: 14 Location: Pune
|
|
|
|
Bill O'Boyle,
Thank you very much...
This is the answer which I was looking for... |
|
Back to top |
|
|
|