Change PF Trigger (CHGPFTRG)

The Change Physical File Trigger (CHGPFTRG) command changes the state, or security of one or all triggers for a file. The triggers have been defined with either the SQL CREATE TRIGGER or the Add Physical File Trigger (ADDPFTRG) command.

The state of a trigger can be changed to disabled (stopped from being called during I/O operations) or, if it has been disabled, to enabled (called during I/O operations again). The alternative to changing the state of the trigger is to remove it when you do not want it to be called, and add it again when you need it.

The security of a trigger can be changed to *YES, or *NO which specifies whether the trigger is considered secure for row and column access control. If row or column access control is active for the triggering table, changing the trigger from secure to not secure will return an error.

Restrictions:

Parameters

Keyword Description Choices Notes
FILE File Qualified object name Required, Positional 1
Qualifier 1: File Name
Qualifier 2: Library Name, *LIBL, *CURLIB
TRG Trigger Character value, *ALL Required, Positional 2
TRGLIB Trigger library Name, *ALL, *CURLIB Optional
STATE Trigger state *SAME, *ENABLED, *DISABLED Optional
TRGSEC Trigger security *SAME, *YES, *NO Optional

File (FILE)

Specifies the file for which a trigger is to be changed. The file must be a physical file.

This is a required parameter.

Qualifier 1: File

name
Specify the name of the physical file.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread 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.
name
Specify the name of the library to be searched.

Trigger (TRG)

Specifies the name of the trigger to be changed.

*ALL
All of the triggers for the file are changed.

Note: When *ALL is specified, all triggers defined for the file will be changed. Any value specified for the Trigger library (TRGLIB) parameter will be ignored.

character-value
Specify the name of the trigger.

Note: The case is preserved when lowercase characters are specified.

Trigger library (TRGLIB)

Specifies the library for the trigger to be changed.

*ALL
All triggers in all trigger libraries will be used.
*CURLIB
The current library for the job is used. If no library is specified as the current library for the job, the QGPL library is used.

Note: The special value *CURLIB is the value of the job running when the trigger is changed.

name
Specify the name of the library to be used.

Trigger state (STATE)

Specifies the state to which the trigger is to be changed. You can use this parameter to temporarily stop a trigger from being called (disable), or to make a trigger that was previously disabled called again during I/O operations (enable).

*SAME
The value does not change.
*ENABLED
The trigger that was disabled will be called during I/O operations again.
*DISABLED
The trigger will not be called during I/O operations.

Trigger security (TRGSEC)

Specifies whether the trigger is considered secure or not secure for row access control and column access control.

*SAME
The value does not change.
*YES
Specifies that the trigger is considered secure for row access control and column access control.
*NO
Specifies that the trigger is considered not secure for row access control and column access control.

Examples

CHGPFTRG   FILE(ADMN/PERSONNEL)  TRG(*ALL)  STATE(*DISABLED)

This command disables all triggers for the PERSONNEL file in the ADMN library.

The following command causes all triggers to be called again:

CHGPFTRG   FILE(ADMN/PERSONNEL)  TRG(*ALL)  STATE(*ENABLED)

Error messages

*ESCAPE Messages

CPF32C6
Trigger operation not successful.