Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

ABSTIME & FORMAT TIME COMMANDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 2:59 pm    Post subject: ABSTIME & FORMAT TIME COMMANDS
Reply with quote

Hello

Sorry if its a duplicate question.

What value we will be getting in ABSTIME(data-area) . how it will be calculated by CICS . i have seen the explanations as
"
The ABSTIME value that is returned by the EXEC CICS ASKTIME command is no longer rounded to the nearest 1/100 second. The absolute time returned is the system time-of-day clock, adjusted for leap seconds and the local timezone offset, truncated to the millisecond, and returned as a packed decimal of length 8 bytes. It therefore represents the number of milliseconds since 00:00 on 1 January 1900 in the local timezone and adjusted for daylight saving time.

"
But am not able to understand what will be in this. Is this the value in milliseconds of time only or with date.

i have code please help to understand this


EXEC CICS
ASKTIME ABSTIME (WS-CICS-TIMESTAMP)
END-EXEC.

EXEC CICS
FORMATTIME ABSTIME (WS-CICS-TIMESTAMP)
MONTHOFYEAR (WS-SYS-DT-M-PACK
DAYOFMONTH (WS-SYS-DT-D-PACK)
YEAR (WS-SYS-DT-CY-PACK)
TIME (WS-SYS-TIME)
END-EXEC.

MOVE WS-SYS-DT-CY-PACK TO WS-SYS-DT-CY-UNPACK.
MOVE WS-SYS-DT-M-PACK TO WS-SYS-DT-M-UNPACK.
MOVE WS-SYS-DT-D-PACK TO WS-SYS-DT-D-UNPACK.

MOVE WS-CICS-TIMESTAMP TO WS-CICS-TIMESTAMP-N.
MOVE WS-CICSTIME-MS TO WS-SYS-TIME-SM.
IF WS-SYS-TIME-SM > 49
IF (WS-SYS-TIME-HH = 0 AND
WS-SYS-TIME-MM = 0 AND
WS-SYS-TIME-SS = 0)
MOVE 24 TO WS-SYS-TIME-HH
END-IF

EVALUATE WS-SYS-TIME-MM = 0 ALSO WS-SYS-TIME-SS = 0
WHEN TRUE ALSO TRUE
MOVE 60 TO WS-SYS-TIME-MM
ADD -1 TO WS-SYS-TIME-HH
ADD -1 TO WS-SYS-TIME-MM
ADD -1 TO WS-SYS-TIME-SS

WHEN FALSE ALSO TRUE
MOVE 60 TO WS-SYS-TIME-SS
ADD -1 TO WS-SYS-TIME-MM
ADD -1 TO WS-SYS-TIME-SS




[/code]
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri May 21, 2010 3:50 pm    Post subject:
Reply with quote

ABSTIME(data-area)
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).
You can use FORMATTIME to change the data into other familiar formats.

For example, after execution of the following command:

EXEC CICS ASKTIME ABSTIME(utime)

utime contains a value similar in format to 002837962864820.

The format of data-area is:

COBOL

PIC S9(15) COMP-3
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 3:55 pm    Post subject: Reply to: ABSTIME & FORMAT TIME COMMANDS
Reply with quote

Hi

i understand that this contains value in milliseconds..
but how milliseconds calculated?

i just ran one prog and i got a abstime value 003483399000260. This should match with todays date with some time..

you can see my code is checking for >49 there..i don't understand why its checking the last two byte of abstime value for that..

and one more this what this menas like it rounded upto 1/500 and 1/100 of vaues
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Fri May 21, 2010 4:02 pm    Post subject: Reply to: ABSTIME & FORMAT TIME COMMANDS
Reply with quote

CICS calculates MILLISECONDS via an Assembler STCK instruction, followed by adjustments. STCK also represents time since 1 January 1900.

This is all done internally, isolating this from most folks.

Beginning with CICS/TS 4.1, the high-order nibble of the last byte of ABSTIME will contain MILLISECONDS, not rounded (as per the IBM documentation).

Prior to CICS/TS 4.1, bytes 7-8 would contain (for example), X'600C', whereas with CICS/TS 4.1 and greater, it would contain (for example), X'607C'.

I uderstand the discrepancy, but this is something you'll have to contact IBM about.

Bill
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 4:04 pm    Post subject: Ok
Reply with quote

But see what i found ..

i got ABSTIME as 003483399000260
and when i try to make to date..i got 5/20/2080 8:20

what does this mean ...i ran the program now...and i am expecting a value of todays date
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Fri May 21, 2010 4:47 pm    Post subject:
Reply with quote

You're doing something wrong:
Code:
  FORMATTIME ABSTIME(+003483399000260)
  STATUS:  COMMAND EXECUTION COMPLETE                         NAME=
   EXEC CICS  FORMattime
    Abstime( +003483399000260 )
    < YYDDD( '10141 ' ) >
    < YYMmdd( '100521  ' ) >
    < YYDDMm( '102105  ' ) >
    < DDMMYY( '210510  ' ) >
    < MMDDYY( '052110  ' ) >
    < YYYYDDD( '2010141 ' ) >
    < YYYYMmdd( '20100521  ' ) >
    < YYYYDDMm( '20102105  ' ) >
    < DDMMYYYy( '21052010  ' ) >
    < MMDDYYYy( '05212010  ' ) >
    < Fulldate( '05212010  ' ) >
    < DATE( '052110  ' ) >
    < DATEForm( 'MMDDYY' ) >
    < DATESep() >
    < DAYCount( +0000040318 ) >
    < DAYOFWeek( +0000000005 ) >
    < DAYOFMonth( +0000000021 ) >
    < MOnthofyear( +0000000005 ) >
    < YEar( +0000002010 ) >
    < TIME( '025000  ' ) < TIMESep() > >
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 5:50 pm    Post subject:
Reply with quote

i have a doubt with abstime data

we are declaring it s9(15) comp 3 then this value is (+003483399000260) is Packed digit...rite?

But it should be of length 8 byte ..why its showing 16 byte value
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Fri May 21, 2010 5:52 pm    Post subject:
Reply with quote

You are not seeing the 8-byte internal format, you are seeing the S9(15) value.
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 5:58 pm    Post subject:
Reply with quote

SO THIS is packed decimal format rite ?

i was trying make this value to date using a internet site which helps to convert millisecs to date and time.

so i think there is my istake
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Fri May 21, 2010 6:12 pm    Post subject:
Reply with quote

Quote:
+003483399000260
THIS IS NOT PACKED DECIMAL.

Quote:
X'003483419949280C'
is a packed decimal value.

Quote:
i was trying make this value to date using a internet site which helps to convert millisecs to date and time.
Probably a Unix site, which uses January 1, 1970 as its starting date -- which would explain the 70-year discrepancy. If you don't want to use CECI on a mainframe, you have to ensure whatever Internet routine you find is based on January 1, 1900.
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 6:16 pm    Post subject:
Reply with quote

Yes..this clears my doubt..Thanks all..

One more doubt..

if we are declaring a dat-area as packed value of s9(15) comp-3 is it possible to see that as +003483399000260 16 byte...

IS it possible to move this value to s9(8) as its storage 8 byte or we need to move this to s9(15)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Fri May 21, 2010 6:23 pm    Post subject:
Reply with quote

If you move it to a PIC S9(08) you will lose the first 7 digits of the number. COBOL stores numbers by the picture clause (except for some special cases which are documented in the manual). While it is important to understand the internal format for variables, especially if using REDEFINES, you also must understand the rules for variable moves.
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 6:59 pm    Post subject: Thanks
Reply with quote

Hi Robert

Thanks very much for helping to understand this..
Back to top
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri May 21, 2010 7:02 pm    Post subject:
Reply with quote

Hi

Would u please help me to understnd this also

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).

and

If the milliseconds come to 500 or more, the returned seconds and, if necessary, the minutes and hours, are rounded up. The day, month, and year are, however, never rounded up. However, in the case where the ABSTIME argument contains a value representing the half-second before midnight, no rounding is performed, and the TIME parameter returns 23:59:59.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7906
Location: Bellevue, IA

PostPosted: Fri May 21, 2010 7:34 pm    Post subject:
Reply with quote

The first bold part of your post indicates that the milliseconds value will always be a multiple of 10 -- 398 will be rounded to 400, 173 will be rounded to 170, and so forth. In other words, when you see a time value in CICS, the last digit will ALWAYS be a zero (at least through z/OS 1.10).


For the second bold part of your post, an example helps. 003483424386760 is a time value that translates to 05/21/2010 at 9:53:06.760. (you can prove this by copying it and using a CECI FORMATTIME ABSTIME(003483424386760) in a CICS region) CICS will show this as 09:53:07 since the millisecond value is greater than 500.
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 -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us