Change PF Constraint (CHGPFCST)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Change Physical File Constraint (CHGPFCST) command changes the state of one or more check constraints for a file or referential constraints between local database files. For referential constraints, 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. For check constraints, the file for the check expression is the file that has been defined in a constraint 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 state of a check constraint can be changed to disabled (stopped from providing validity checking) or, if it has been disabled, to enabled (providing validity checking 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:

Top


 

Parameters

Keyword Description Choices Notes
FILE File Qualified object name Required, Positional 1
Qualifier 1: File Name
Qualifier 2: Library Name, *LIBL, *CURLIB
CST Constraint name Single values: *ALL, *CHKPND
Other values (up to 300 repetitions): Character value
Required, Positional 2
STATE Constraint state *SAME, *ENABLED, *DISABLED Optional

Top

 

File (FILE)

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

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.

Top

 

Constraint name (CST)

Specifies the name of the constraint relationship being changed.

This is a required parameter.

Single values

*ALL

All of the constraint relationships for the file or 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.

Other values (up to 300 repetitions)

character-value

Specify the name of the constraint relationship.

The case is preserved when lowercase characters are specified.

Top

 

Constraint state (STATE)

Specifies the state to which the constraint is being changed. You can use this parameter to temporarily stop (disable) a defined or established constraint from providing referential integrity (*REFCST) or data validity checking (*CHKCST), 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 (*REFCST) or validity checking (*CHKCST) again.

*DISABLED

The constraint stops providing referential integrity or validity checking.

Top


 

Examples

 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)

Top


 

Error messages

*ESCAPE Messages

CPF32B2

Constraint cannot be changed for file &1.

Top