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

C Compile time time stamps


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Grant Goodale

New User


Joined: 13 Nov 2010
Posts: 67
Location: Brampton, Ontario, Canada

PostPosted: Sun Sep 24, 2023 8:25 pm
Reply with quote

Using the z/OS XL C compiler. I would like to have a time stamp included the the generated object code. I know how to do it in Assembler and I believe that there is a way in Java but I cannot seem to find anything in C.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2589
Location: Silicon Valley

PostPosted: Sun Sep 24, 2023 10:25 pm
Reply with quote

Quote:
a time stamp


You probably want the time that it was compiled. I could not find that either, but there is a macro variable __timestamp__ which provides a date based on the last change date of the source. See chapter 19 of the Language Reference.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2126
Location: USA

PostPosted: Sun Sep 24, 2023 11:42 pm
Reply with quote

You could use __DATE__ and __TIME__.
Back to top
View user's profile Send private message
Grant Goodale

New User


Joined: 13 Nov 2010
Posts: 67
Location: Brampton, Ontario, Canada

PostPosted: Mon Sep 25, 2023 1:04 am
Reply with quote

Thank you all for the replies. Unfortunately, none solved my problem.

However, I did look in the object code generated and I see the following right after the XSD for main:

XSD f main
TXT 20230924153257020400 =
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2126
Location: USA

PostPosted: Mon Sep 25, 2023 1:21 am
Reply with quote

What is any relation between C language & object code, and Java & MQSeries - ???

And what exactly so called "your problem" is???
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2589
Location: Silicon Valley

PostPosted: Mon Sep 25, 2023 10:52 am
Reply with quote

You were not clear in showing what you tried but that did not work. Isn't it just something like this?
Code:
const char tstamp = __date__ + __time__;
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1319
Location: Bamberg, Germany

PostPosted: Mon Sep 25, 2023 11:13 am
Reply with quote

Pedro wrote:
You were not clear in showing what you tried but that did not work. Isn't it just something like this?
Code:
const char tstamp = __date__ + __time__;


STFW found:
Code:
const char *datetime_str = __DATE__ " " __TIME__;
Back to top
View user's profile Send private message
Grant Goodale

New User


Joined: 13 Nov 2010
Posts: 67
Location: Brampton, Ontario, Canada

PostPosted: Mon Sep 25, 2023 9:06 pm
Reply with quote

I am trying to get a compile date and time into the object code. If an end user reports a problem, I want to know if they have the most recent version.

Again, thanks to everyone for the information provided.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2126
Location: USA

PostPosted: Mon Sep 25, 2023 10:04 pm
Reply with quote

Grant Goodale wrote:
I am trying to get a compile date and time into the object code. If an end user reports a problem, I want to know if they have the most recent version.

Again, thanks to everyone for the information provided.

You've received several explicit examples how to do what you want.
But you continue repeating your mantra: "Unfortunately, none solved my problem"
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2589
Location: Silicon Valley

PostPosted: Mon Sep 25, 2023 11:39 pm
Reply with quote

re: "trying to get a compile date and time into the object code."

When I was at IBM, it was not the compile time that was important, but the APAR number string. We just kept appending the most recent APAR number at the end of a constant. Any defined constants will appear in the OBJ file and load module.

Sort of like this:

Code:
const char APAR_str = "APAR: P10001 P10002 P10003";


When the string got too long, we removed the oldest number.

You probably do not have APARs, but perhaps you can use some number from your problem tracking program. Or even just a short blurb describing the most recent change.
Back to top
View user's profile Send private message
Grant Goodale

New User


Joined: 13 Nov 2010
Posts: 67
Location: Brampton, Ontario, Canada

PostPosted: Wed Sep 27, 2023 8:52 pm
Reply with quote

Pedro, thanks. You have raised a good point.
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 -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts Compile Sp Cobol base COBOL Programming 1
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top