Posted: Wed Mar 12, 2003 1:19 am Post subject: OS/390 Assembler - Would like help with 'time' functions
Good day,
I would like to request your help in researching and finding a possible solution to my problem. My issue is going to deal with using the OS/390 mainframe system and the assembler language to modify my existing source code by somehow getting the system time from the mainframe and then putting this time into my program as a timestamp of some sort. My existing program is only a small lab exercise dealing with a somewhat large data file that will be printed. A timestamp (even the date) would be appropriate as an additional part of my program.
Currently, I am a student, but this additional coding is not being required of me, but I would like to find out information on possibly how to code this along with a technical explanation of what is going with the system.
I was able to find out a "a little" technical information about this subject and will post it below. I have searched through my book, which does not list any useful (at least in my opinion) information about how to solve this issue.
What I was able to find out from a system administrator on the mainframe system, is this: (I have already taking out a big chunk of the email I received so as not to overload you with too much information)
I was informed that assembler language has a macro called 'time'. When used with an operand of BIN the executable code will return to the invoking application a value in GPR 0, which represents the processor's current 'time of day'.
The value in register 0 is an unsigned binary, wherein the low-order bit is .01 second. The value returned from the register will be a large binary number indicating how many 1/100ths of a second have elapsed since midnight.
This value returned should be converted to normal clock time; hours, minutes and seconds. The result value for hours should be a binary integer between 0 and 23; minutes should be an integer between 0 and 59; seconds should be an integer between 0 and 59. These items just mentioned were pretty easy to come up with because they directly relate to our normal time scheme.
The binary integers should be placed into separate fullwords, then build a parameter list according to standards (with register 1 pointing to the parameter list), then we would have to call a sub-program name (whatever we decide to call it).
First fullword should be a pointer to a fullword holding the binary value for hours. The second fullword, a pointer to a fullword holding the binary value for minutes. The third fullword, a pointer to a fullword holding the binary value for seconds.
Each whole hour since midnight has 360,00 timer-units. Each whole minute since the last hour has 6000 timer-units. Each whole second since the last minute has 100 timer-units.
From reading my book I was able to surmise the following, hopefully, I am right.
1) The program input will be in an input value from the mainframe system from the macro 'time'
2) To perform the calculations, the use of DIVIDE (DIV) will be used to get these results somehow.
3) My program output is going to be a single line printed after my data file has been printed.
I believe this is about it for now. In researching this topic, the amount of information I cannot seem to find. Either I am looking in the wrong place or just doing it all wrong. My financial resources will not allow me to go out and buy an expensive book(s) on the subject until next quarter.
My time period is two weeks to hopefully come up with this solution, but I will not be knocked down on my grade if it isnt completed, since this additional coding was not assigned to me.
If you are able to help me in any way and/or to provide me with a possible resource leading to a solution, I would be honorably greatful. The system administrator I talked to to get this information wasnt to kind to me in giving me this information and it showed in the person's email to me.
Thank you for listening to request. I look forward in hearing from you shortly.
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
Posted: Wed Mar 12, 2003 9:28 am Post subject:
I think the TIME question is one we all face at one time or another with OS/390 assembler. The approach you have looks good. I haven't used TIME in a while, but I believe there is also a DEC option which gives you the the information in a semi-formatted way. If I recall, it gives you the registers formatted in HHMMSShh format for time and something similar for date. To use that, you need to treat it similar to a packed decimal number and use the UNPK instruction to get the pieces. Something like that, anyway, but you might want to have a look at it.
Good luck with the 'extra credit'. You might want to do some searches around the net as there are probably examples to give you the idea.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Mar 12, 2003 4:57 pm Post subject:
Eric,
The TIME macro returns either the local time of day and date, the Greenwich mean time of day and date, or the contents of the time-of-day (TOD) clock. The time-of-day clock referenced can be either in the basic time-of-day format (TOD) or the extended time-of-day format (ETOD).
You can use the STCKCONV and CONVTOD macros to convert between TOD-clock format and various time of day and date formats. The STCKCONV macro converts a TOD-clock value to a time of day and date value and the CONVTOD macro converts a time of day and date value to a TOD clock value.
check this link for a complete and detailed explanation of the time macro.
I would like to thank all of you who posted information to me. The suggestions and links to the documentation is a wonderful asset.
My reasoning for using BIN is to practice using arithmetic with fixed-point binary numbers. I didnt fully understand the explanations that the CBT gave me, it was very confusing.
"BIN returns the time of day as an unsigned 32-bit binary number with the low-order bit equivalent to 0.01 second. The second word of the time value returned is zero.
MIC returns the time of day in microseconds. The value is returned as 8 bytes of information where bit 51 is equivalent to one microsecond.
STCK returns the contents of the basic TOD clock as an unsigned 64-bit binary number where bit 51 is equivalent to one microsecond.
STCKE returns the contents of the extended TOD clock (ETOD) as an unsigned 128-bit binary number where bit 59 is equivalent to one microsecond.
Note: The resolution of the time-of-day clock is model dependent. See Principles of Operation for an explanation of the rate advancement. "
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum