RMVPFTRG (Remove Physical File Trigger)
RMVPFTRG Command syntax diagram
Purpose
The Remove Physical File Trigger (RMVPFTRG) command removes the triggers that call trigger programs from a specified physical file. The triggers to be removed can be specified by trigger names, trigger events and trigger times. A trigger program is a program that has been added to the specified physical file by the Add Physical File Trigger (ADDPFTRG) command (system trigger) or by the Structured Query Language CREATE TRIGGER statement (SQL trigger).
Once a trigger is removed from the physical file for a specified trigger time or event, the trigger program is no longer called when the trigger event occurs within the file. The program continues to exist on the system for system triggers. The program is deleted for SQL triggers.
An exclusive-no-read lock is held on the physical file when removing the trigger from that file. All logical files which are built over the physical file are also held with the exclusive no-read lock.
Restrictions
- You must have object alter or object management authority to the physical file, and execute authority to the library that the physical file is in.
- If the physical file or a dependent logical file or Structured Query Language (SQL) view is opened in this or another job, the trigger cannot be removed.
- While this command is running, neither the physical file nor any dependent logical files can be opened.
- In multithreaded jobs, this command is not threadsafe for distributed files and fails for distributed files that use relational databases of type *SNA.
Required Parameters
- FILE
- Specifies the qualified name of the physical file from which this trigger is removed. The file name must exist on the system.
The name of the physical file can be qualified by one of the following library values:
*LIBL: All libraries in the job's library list are searched until the first match is found.
*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be searched.
physical-file-name: Specify the name of the file from which the trigger is removed.
Optional Parameters
- TRGTIME
- Specifies the trigger to be removed, based on the time when the trigger program is called.
*ALL: All triggers for programs called either before or after a trigger event are removed.
*BEFORE: The triggers for programs called before a trigger event are removed.
*AFTER: The triggers for programs called after a trigger event are removed.
- TRGEVENT
- Specifies the trigger event for which the associated triggers are removed.
*ALL: All triggers for insert, delete, update and read operations are removed.
*INSERT: The triggers for insert operations are removed.
*DELETE: The triggers for delete operations are removed.
*UPDATE: The triggers for update operations are removed.
*READ: The triggers for read operations are removed.
- TRG
- Specifies the name of the trigger to be removed.
*ALL: All triggers are removed from the file, including SQL triggers.
trigger-name: Specify the name of the trigger to be removed. You can specify a maximum of 128 characters without delimiters or 258 characters with quotation mark (") delimiters.
- TRGLIB
- Specifies the name of the library that the trigger is to be removed from.
*FILE: The library for the file specified on the FILE parameter is used.
*CURLIB: The current library is used. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be used.
Examples for RMVPFTRG
Example 1: Removing All Triggers for Insert Events
RMVPFTRG FILE(EMP) TRGEVENT(*INSERT)This command removes all triggers for programs called by insert operations from the physical file named EMP.
Example 2: Removing All Triggers for Programs Called Before a Trigger Event
RMVPFTRG FILE(EMP) TRGTIME(*BEFORE)This command removes all triggers for programs called before trigger events from the physical file named EMP.
Example 3: Removing a Trigger for a Program Called After an Insert Event
RMVPFTRG FILE(EMP) TRGTIME(*AFTER) TRGEVENT(*INSERT)This command removes the trigger for the program called after an insert operation from the physical file named EMP.
Error messages for RMVPFTRG
*ESCAPE Messages
- CPF32C6
- Trigger operation not successful.