Peter, I'll start up saying I don't have access to a system that I can try this 
on.

Have you looked at the FORMATTED-TIME function?  This looks to be part of COBOL 
6.3.  My concern would be that you still might not get the uniqueness you are 
looking for.

FORMATTED-TIME: The FORMATTED-TIME function uses a format to convert a value 
that represents seconds past midnight to a formatted time of day in the 
requested format.


>From the Enterprise COBOL for z/OS 6.3 Language Reference manual.

Format
FUNCTION FORMATTED-TIME ( argument-1 argument-2 argument-3)

argument-1
Must be a national, a UTF-8, or an alphanumeric literal.
The content of argument-1 must be a time format. For details, see “Date and 
time formats” on page 468.

argument-2
Must be a numeric value in standard numeric time form. For details, see 
“Standard numeric time form” on page 468.
A value in standard numeric time form is a numeric value that represents 
seconds past midnight.

argument-3
Argument-3 is an integer representation of the offset from Coordinated 
Universal Time (UTC) expressed in minutes. If argument-3 is specified, the 
magnitude of the value must be less than or equal to 1439. For details, see 
“UTC offset value” on page 468.


Paul

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Peter Farley
Sent: Sunday, February 18, 2024 6:23 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Nanosecond resolution timestamps for HLL's?

I have been reviewing all the documentation I can find to provide nano-second 
resolution timestamps from a calling HLL batch program.  STCK and STCKE 
instructions of course provide this (and more) resolution, but using them from 
any HLL besides C/C++ requires an assembler subroutine (however simple that may 
be for those of us who are already comfortable in assembler).  In shops where 
any new assembler functionality is proscribed or strongly discouraged can't or 
would strongly prefer not to use assembler for this functionality.

The only HLL-callable function already provided in z/OS that I can find that 
provides anything near that resolution is the LE Callable Services function 
CEEGMT, but two calls to that service from a COBOL program in a row separated 
by only a few calculations and a DISPLAY to SYSOUT produce identical values.  
This is not good enough for high-volume processing needs.  Every request for a 
time value needs to generate a new higher value.

Is there any other place I am not yet looking which provides nano-second 
resolution like STCK/STCKE and the linux function clock_gettime() besides an 
assembler invocation of STCK/STCKE?  z/OS Unix has not yet implemented the 
clock_gettime() function anyway, so that is off the table.  The calling HLL 
here will be COBOL, so the C/C++ builtin functions "__stck" and "__stcke" are 
not available.  Would that they were, but they are not at this time.  (Maybe 
that calls for a new "idea" to IBM . . . ?)

HTH for any pointers or RTFM you can provide.

Peter

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to