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

COBOL Time in Micro Second Level


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

New User


Joined: 08 Dec 2006
Posts: 12
Location: Kolkata

PostPosted: Tue Nov 25, 2008 6:40 pm
Reply with quote

Hello Team,

In COBOL-74 there is a special register called TIMER which Represents the number of 2.4-microsecond intervals since midnight. It is a single, unsigned 11-digit, numeric integer.

for example say the time is midnight+4.8 microsecond then it will return 2,if it 7.2 then it will return 3.

I have to convert this COBOL program into Enterprise COBOL. Please suggest me how can i implement this. Is there any function/register that can manipulate time at microsecond level?

True Regards,
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Nov 25, 2008 7:04 pm
Reply with quote

Intrinsic FUNCTION CURRENT-DATE in Enterprise COBOL can give you resolution up to 100th of a second. Check in the manuals for more details and let us know if you need something else.
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: Tue Nov 25, 2008 7:04 pm
Reply with quote

To get that level of precision in Enterprise COBOL, you may have to call an Assembler program to get you the time.
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: Tue Nov 25, 2008 9:07 pm
Reply with quote

I believe the only way to get this is via a CALL to an ASSEMBLER sub-program, who issues a STCK (Store Clock) instruction.

Refer to your applicable Principles of Operation manual for the definition/use of STCK (One Doubleword) as well as STCKE (Store Clock Extended --- Two Doublewords).

STCKE was defined by IBM because STCK overflows September 2042 (not that I'm worried) icon_wink.gif

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

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Nov 26, 2008 2:00 am
Reply with quote

Quote:
STCKE was defined by IBM because STCK overflows September 2042 (not that I'm worried)
Some times I wonder ..how do you guys know this much - I would need to do a lot more labour..hff...


-Ad
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: Wed Nov 26, 2008 2:18 am
Reply with quote

Huh? You trying to say this isn't common knowledge? That surprises me! icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 26, 2008 2:32 am
Reply with quote

and before using the stck/stcke it would be importnt to well understand the implications...
the best source of info is the z architecture principle of opertions
searching for "STORE CLOCK" will give a lot of info to meditate on..

for example


Quote:

..... snipped a few lines
.... For the same reasons, conversion
| between ETR time and UTC does not take
| into consideration the time adjustments prior
| to 1972, and, thus, ETR time differs from TAI
| by a fixed amount of 10 seconds. Because of
| the occurrence of 22 leap seconds, UTC now
| is behind TAI by 32 seconds.
4. A program using the clock value as a timeof-
day and calendar indication must be consistent
with the programming support under
which the program is to be executed. If the
programming support uses the standard
epoch, bit 0 of the clock remains one through
the years 1972-2041. (Bit 0 turned on at
11:56:53.685248 (UTC) May 11, 1971.) Ordinarily,
testing bit 0 for a one is sufficient to
determine if the clock value is in the standard
epoch.
5. In converting to or from the current date or
time, the programming support must take into
account that “leap seconds” have been
inserted or deleted because of time-correction
standards. When the TOD clock has been set
correctly to a time within the standard epoch,
the sum of the accumulated leap seconds
must be subtracted from the clock time to
determine UTC time.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Nov 26, 2008 2:41 am
Reply with quote

follow on to my previous post...
it would be better to investigate the use of the time macro
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Nov 26, 2008 2:58 am
Reply with quote

Robert Sample wrote:
Huh? You trying to say this isn't common knowledge? That surprises me! icon_lol.gif
Well, "that statement" just didn't click me that time.. icon_razz.gif
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 26, 2008 10:55 am
Reply with quote

A slightly different approach would be to use the 1st 16 digits of the function current-date (ccyymmddhhmmssth) and append an additional 4 digits to the end to fill out the entire microsecond portion of the time. The additional 4 digits could be a sequential number which would increment until the hundredths (th) changed, then start the 4 digits over again at 0001.
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: Wed Nov 26, 2008 5:53 pm
Reply with quote

Quote:
STCKE was defined by IBM because STCK overflows September 2042 (not that I'm worried)
Some times I wonder ..how do you guys know this much - I would need to do a lot more labour..hff...
Isn't this like knowing about the Unix time overflows in January 2038?
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts How to load to DB2 with column level ... DB2 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top