IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to get absolute time in X(15) form.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gaurav Bhayawala

New User


Joined: 17 Apr 2008
Posts: 14
Location: Pune

PostPosted: Mon Nov 17, 2008 7:06 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Nov 17, 2008 7:09 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Nov 17, 2008 7:13 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Nov 17, 2008 7:21 pm
Reply with quote

follow on to my previous post...
I would go with the LE convention

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ceea3180/2.2.5.65?ACTION=MATCHES&REQUEST=time&TYPE=FUZZY&SHELF=CEE2BK80.bks&DT=20070428023816&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT

ceesecs and ceedatm make the conversion quite straigthforward
Back to top
View user's profile Send private message
Gaurav Bhayawala

New User


Joined: 17 Apr 2008
Posts: 14
Location: Pune

PostPosted: Mon Nov 17, 2008 7:24 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Nov 17, 2008 7:33 pm
Reply with quote

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
View user's profile Send private message
Gaurav Bhayawala

New User


Joined: 17 Apr 2008
Posts: 14
Location: Pune

PostPosted: Mon Nov 17, 2008 7:44 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Nov 17, 2008 10:01 pm
Reply with quote

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
View user's profile Send private message
Gaurav Bhayawala

New User


Joined: 17 Apr 2008
Posts: 14
Location: Pune

PostPosted: Tue Nov 18, 2008 1:24 pm
Reply with quote

Bill O'Boyle,

Thank you very much...
This is the answer which I was looking for...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
No new posts C Compile time time stamps Java & MQSeries 10
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
Search our Forums:

Back to Top