CHGPFCST (Change Physical File Constraint)

CHGPFCST Command syntax diagram

 

Purpose

The Change Physical File Constraint (CHGPFCST) command changes the state of one or more referential constraints between local database files. The local database files of a constraint are physical files that have been defined in a parent and dependent relationship with either the SQL interface or the Add Physical File Constraint (ADDPFCST) command.

The state of a referential constraint can be changed to disabled (stopped from providing referential integrity) or, if it has been disabled, to enabled (providing referential integrity again). The alternative to changing the state of the constraint is to remove it when you do not want it to be used, and add it again when you need it.

 

Restrictions

  1. You must have object management or object alter authority to the physical file.
  2. You must have execute authority to the library qualifier of the physical file.

 

Required Parameters

FILE
Specifies the dependent file for which a constraint is being changed, and the library of the dependent file. The file must be a physical file and it must allow a maximum of one member (MAXMBRS(1)).

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 physical file.

CST
Specifies the name of the constraint relationship being changed.

*ALL: All of the constraint relationships for the dependent file are changed.

*CHKPND: The constraint relationships that have records that possibly are in violation of the constraints and are pending verification (check pending) are changed.

constraint-name: Specify the name of the constraint relationship. The case is preserved when lowercase characters are specified.

 

Optional Parameters

STATE
Specifies the state to which the constraint is being changed. Use this parameter to temporarily stop a defined or established constraint from providing referential integrity (disable), or to make a constraint that was previously disabled to start working again (enable).

*SAME: The value does not change.

*ENABLED: The constraint that was disabled starts providing referential integrity again.

*DISABLED: The constraint stops providing referential integrity.

Examples for CHGPFCST

CHGPFCST   FILE(ADMN/PERSONNEL)  CST(*CHKPND)
  STATE(*DISABLED)

This command disables the referential constraints that have caused records in the PERSONNEL file of the ADMN library to be in check pending status. While referential integrity is disabled, the user can correct the records that are causing the check pending.

After the records are corrected, the following command is run to provide referential integrity again.

CHGPFCST   FILE(ADMN/PERSONNEL)  CST(*CHKPND)
  STATE(*ENABLED)

Error messages for CHGPFCST

*ESCAPE Messages

CPF32B2
Constraint cannot be changed for file &1.