Triggers can use named commons to create persistent data across the various operations.
Example(s)
To audit all accesses to a file, the application opens the audit file in the open trigger and stores the file descriptor in the common, along with the file name and an audit message number:
OpenTrigger subroutine OpenTrigger( InputFileName ) common /audit/ AuditFd, FileName, MsgNumber open “dm,Audit,” to AuditFd FileName = InputFileName MsgNumber = 1 writev “Opening “:FileName to AuditFd, FileName, MsgNumber return |
The write trigger or the read trigger accesses the audit file using this file descriptor in the common:
ReadTrigger subroutine ReadTrigger( Record ) common /audit/ AuditFd, FileName, MsgNumber Msg = “Reading “:Access(10):” from “:FileName MsgNumber = MsgNumber + 1 writev Msg to AuditFd, FileName, MsgNumber return |
The close trigger closes the audit file:
CloseTrigger subroutine CloseTrigger( File ) common /audit/ AuditFd, FileName, MsgNumber Msg = “Closing:FileName MsgNumber = MsgNumber + 1 writev Msg to AuditFd, FileName, MsgNumber close AuditFd return |
NOTE |
|