IBM OS/390 User Manual

Page of 673
13.2.3 Interrupt Handling Routines
Interrupt routines take care of the interval timer, abnormal conditions, and
operator communication interrupts. Abnormal condition interrupts will not be
addressed in this publication.
13.2.3.1 Interval Timer Interrupts
Basically, the two ways of utilizing the interval timer in your programs are
routine handling and wait handling.
Routine Handling
This method allows a branch to your own routine when the interval timer
interrupt occurs. The following illustrates the VSE macros and corresponding
MVS macro needed to perform this operation:
┌─────┬──────────┬────────────────────────────────────────┐
│ │STXIT │IT, rou─ine address
,
save area
│ │
(0)
(1)
│ VSE │SETIME
│seconds
(1)
│EXIT
│IT
├─────┼──────────┼────────────────────────────────────────┤
│REAL , ─imer comple─ion exi─ address │
│TASK
(2-12)
│WAIT
,DINTVL = address
(2-12)
│ MVS │STIMER
,BINTVL = address
(2-12)
,TUNINTVL=address
(2-12)
,TOD = address
(2-12)
└─────┴──────────┴────────────────────────────────────────┘
The VSE macro instructions allow you to execute a routine when a timer
interrupt occurs and then to return to the program that was being executed prior
to the interruption. The STXIT macro provides the address of the routine to be
executed. A register save area must also be specified in the STXIT macro. The
saving and restoring of the registers are performed automatically by the
supervisor. The SETIME macro sets the interval timer. The EXIT macro returns
from the specified routine (STXIT macro) to the point in the interrupted program
where the interruption occurred.
The single MVS macro (STIMER) also allows you to execute a routine when the
timer interrupt occurs. The REAL parameter indicates that time is to be
decreased continually, while TASK means that the timer is stopped or adjusted
only when the task is active. WAIT means that the job step is to be placed in a
wait state until the interval expires. The timer completion exit address parameter
is the same as the routine address used in the VSE STXIT macro.
The DINTVL parameter indicates that the time interval requested is in decimal
units and is stored in the address specified. The MVS timer routine must follow
the standard conventions for handling registers.
You must save the registers on initiation and restore them at routine termination.
Chapter 13. A s s e m b l e r
287