TRAPCLR Examples
Example 1:
|
|
|
|
|
|
|
|
|
|
|
|
The TRAP instruction specifies that the program should CALL the subroutine NOMASTER if an IO error occurs. After the logical file APMASTER is opened, it is recommended that the IO trap be cleared or set to another routine. The TRAPCLR IO clears the previously set TRAP for IO.
Example 2:
(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(2)
|
|
|
|
|
|
|
|
|
|
|
|
Since only one TRAP may be set for each possible event, the second TRAP replaces the previous TRAP until an appropriate TRAPCLR is executed, the trapped for event occurs or the program terminates.
Example 3:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This section of code saves the currently set traps, clears all function key traps, sets new traps for F1 & F3. At the end of the routine, the original traps are reset using the TRAPRESTORE instruction.
![]() |