The STIMER macro sets a timer to a specified time interval or to an interval that will expire at a specified time of day. An optional asynchronous timer completion exit is given control when the time interval expires; if no asynchronous timer completion routine is specified, no indication that the time interval has expired is provided. A second STIMER macro issued before the first time interval expires overrides the first interval and exit routine.
The time interval may be a ‘real-time interval’ (measured continuously in real time by the clock comparator), or a ‘task-time interval’ (measured, only while the task is in execution, by the CPU timer). See Principles of Operation for information on the clock comparator and CPU timer. If a real-time interval is specified, the task may elect to either continue (REAL) or suspend (WAIT) execution during the interval. If the task elects to continue execution, it may optionally specify an exit routine to be given control on completion of the time interval. If the task elects to suspend execution, it is restarted at the next sequential instruction, sometime after completion of the time interval. If a task-time interval is specified, the task must continue. It may optionally specify an exit routine to be given control on completion of the interval.
STIMER allows you to set one time interval for one task; STIMERM allows you to set 16 separate time intervals for a task. Using the two macros together allows you to set 17 separate intervals for a task.
For information on how to select an MVS/SP version other than the current version, see Compatibility of MVS macros. If your program is to execute in 31-bit addressing mode, you must use the SP Version 2 expansion of this macro or a later version.
The requirements for the caller are:
Environmental factor | Requirement |
---|---|
Minimum authorization: | Problem state and any PSW key. |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN=HASN=SASN |
AMODE: | 24- or 31- or 64-bit |
ASC mode: | Primary |
Interrupt status: | Enabled for I/O and external interrupts |
Locks: | No locks held |
Control parameters: | Must be in the primary address space. |
The timer completion exit routine must be in virtual storage when it is required.
Before issuing the STIMER macro, the caller does not have to place any information into any register unless using it in register notation for a particular parameter, or using it as a base register.
Some callers depend on register contents remaining the same before and after issuing a service. If the system changes the contents of registers on which the caller depends, the caller must save them before issuing the service, and restore them after the system returns control.
None.
The STIMER macro is written as follows:
Syntax | Description |
---|---|
name | name: Symbol. Begin name in column 1. |
␢ | One or more blanks must precede STIMER. |
STIMER | |
␢ | One or more blanks must follow STIMER. |
REAL |
exit rtn addr: RX-type address, or register (0) or (2) - (12). |
,BINTVL=stor addr |
stor addr: RX-type address, or register (1) or (2) - (12). |
The parameters are explained as follows:
For REAL, the interval is decreased continuously. If the TOD, GMT, or LT parameter is coded, the interval expires at the indicated time of day.
For TASK, the interval is decreased only when the associated task is running.
For WAIT, the interval is decreased continuously. The task is to be placed in the wait condition until the interval expires.
The exit routine is responsible for saving and restoring registers. The exit routine runs as a subroutine, and must return control to the address identified in register 14. Although timing services allows only one active time interval for a task, it does not serialize the use of an asynchronous timer completion exit routine.
For BINTVL, the address is a 4-byte area containing the time interval. The time interval is represented as an unsigned 32-bit binary number; however, the high-order bit of the time interval must not be set. Therefore, the time interval specified cannot exceed X'7FFFFFFF'. The low-order bit of the time interval has a value of 0.01 second.
For DINTVL, the address is a doubleword in virtual storage containing the time interval. The time interval is presented as zoned decimal digits of the form:
For GMT, the address is an 8-byte area containing the Greenwich mean time at which the interval is to be completed. The time is presented as zoned decimal digits of the form HHMMSSth, as described above under DINTVL.
For MICVL, the address is a doubleword containing the time interval. The time interval is represented as an unsigned 64-bit binary number; bit 51 is the low-order bit of the interval value and equivalent to 1 microsecond.
For TUINTVL, the address is a fullword containing the time interval. The time interval is presented as an unsigned 32-bit binary number; the low-order bit has a value of one timer unit (approximately 26.04166 microseconds).
For TOD and LT, the address is a doubleword containing the local time of day at which the interval is to be completed. The time is presented as zoned decimal digits of the form HHMMSSth, as described under DINTVL.
The LT and TOD parameters perform identical functions. However, the name for the LT parameter (LT, or local time) describes the function more accurately than does the name for the TOD parameter (TOD, or time-of-day). Therefore, for clarity purposes, IBM recommends the use of the LT parameter instead of TOD.
The priorities of other tasks in the system can also affect the accuracy of the time interval measurement. If you code REAL or WAIT, the interval is decreased continuously and can expire when the task is not active. After the time interval expires, assuming the task is not in the wait condition for any other reasons, the task is placed in the ready condition and competes for control with the other ready tasks in the system. The additional time required before the task becomes active depends on the relative dispatching priority of the task.
STIMER might abnormally terminate with one the following abend codes: X'12F' (with reason code X'0', X'4', X'C', X'10', X'14', X'28'), or X'AC7' (with reason code X'2'). See z/OS MVS System Codes for an explanation and response for these codes.
STIMER returns a return code of 0 in register 15.
STIMER REAL,EXIT,BINTVL=INTVLONG
⋮
INTVLONG DC F '14' TIME INTERVAL
STIMER REAL,EXIT,LT=LOCAL
⋮
LOCAL DS 2F
STIMER WAIT,BINTVL=INTV2
⋮
INTV2 DC F'6000'
STIMER TASK,EXIT,BINTVL=INTV1
⋮
INTV1 DC F'6000'