FREE PACKAGE (DSN)

The DSN subcommand FREE PACKAGE can be used to delete a specific version of a package, all versions of a package, or whole collections of packages.

The FREE PACKAGE subcommand deletes corresponding table entries from the catalog tables. Authorization for a package name is removed only when no more versions of the package exist. After a version of a package has been freed, that package name is then available for use in a BIND PACKAGE subcommand to create a new package.

Start of changeFor active package copies, the FREE PACKAGE subcommand does not proceed until all currently running applications that use the package finish running. However, if you specify INACTIVE, PREVIOUS, or ORIGINAL for the PLANMGMTSCOPE option, the FREE PACKAGE subcommand can free the inactive package copies while the applications are running.End of change

Start of changeThe FREE PACKAGE subcommand also deletes phased-out package copies.End of change

Environment

You can enter this subcommand from DB2I, or from a DSN session under TSO that is running in either foreground or background.

Data sharing scope: Group

Authorization

To execute this subcommand, you must use a privilege set of the process that includes one of the following privileges or authorities:
  • Ownership of the package
  • BINDAGENT privilege granted by the owner of the package
  • System DBADM authority
  • SYSCTRL authority
  • SYSADM authority
  • PACKADM authority for the collection or for all collections

The BIND privilege on a package is not sufficient to allow a user to free a package.

Syntax

Read syntax diagramSkip visual syntax diagram FREE PACKAGE (,location-name.collection-id*.package-id*.(version-id*)*) FLAG(IWEC) PLANMGMTSCOPE(ALLINACTIVEPREVIOUSORIGINALPHASEOUT)INVALIDONLY(NOYES)

Option descriptions

location-name
Specifies the location of the DBMS where the package is to be freed. The location name must be defined in the SYSIBM.LOCATIONS table. If this table does not exist or the DBMS is not found, you receive an error message. If the location name is specified, the name of the local Db2 subsystem must be defined.

The default is the local Db2 subsystem if you omit location-name .

collection-id or (*)
Identifies the collection of the package to be freed. There is no default.

You can use an asterisk ( * ) to free all local packages with the specified package-id in all the collections that you are authorized to free. (You cannot use the * to free remote packages.)

collection-id can be an undelimited or a delimited identifier. The delimiter for collection-id is double quotation marks ("). If collection-id is delimited, Db2 does not convert the value to uppercase.

package-id or (*)
Identifies the package to be freed. There is no default.

You can use an asterisk ( * ) to free all local packages in the collection-id that you are authorized to free. (You cannot use the * to free remote packages.)

package-id can be an undelimited or a delimited identifier. The delimiter for package-id is double quotation marks ("). If package-id is delimited, Db2 does not convert the value to uppercase.

version-id or (*)
Identifies the version of the package to be freed.

You can use an asterisk ( * ) to free all local packages in the collection-id and package-id that you are authorized to free. (You cannot use the * to free remote packages.)

If you specify () for version-id , the empty string is used for the version ID.

If you omit the version-id , the default depends on how you specify package-id . If you use * for package-id , version-id defaults to *. If you provide an explicit value for package-id , version-id defaults to an empty string.

( * )
Frees all local Db2 packages that you are authorized to free.

Specifying (*) is equivalent to specifying the package name as (*.*.(*)) or (*.*).

FLAG
Indicates what messages you want the system to display. Use one of the following values to show messages of the corresponding types.
( I )
All: informational, warning, error, and completion messages.
(W)
Only warning, error, and completion messages.
(E)
Only error and completion messages.
(C)
Only completion messages.
PLANMGMTSCOPE
Allows you to manually free inactive copies of packages. Use one of the following options to help reclaim disk space:
ALL
Frees the entire package, including copies. This is the default. Start of changeThis option is not supported for trigger packages or SQL routines.End of change
INACTIVE
Frees only previous, original, or eligible phased-out copies from the directory, catalog, and access path repository. FREE PACKAGE with PLANMGMTSCOPE(INACTIVE) succeeds even if the package has no inactive copies. Start of changeInactive package copies can be freed while applications that use the package are running.End of change The phased-out copies can also be freed regardless of the INVALIDONLY option.
Start of changeORIGINALEnd of change
Start of changeFrees original package copies from the directory, catalog, and access path repository. FREE PACKAGE with PLANMGMTSCOPE(ORIGINAL) succeeds even if the package has no original package copies. Start of changeOriginal package copies can be freed while applications that use the package are running.End of changeEnd of change
Start of changePREVIOUSEnd of change
Start of changeFrees previous package copies from the directory, catalog, and access path repository. FREE PACKAGE with PLANMGMTSCOPE(PREVIOUS) succeeds even if the package has no previous package copies. Start of changePrevious package copies can be freed while applications that use the package are running.End of changeEnd of change
PHASEOUT
Frees eligible phased-out copies from the directory, catalog, and access path repository. FREE PACKAGE with PLANMGMTSCOPE(PHASEOUT) succeeds even if the package has no phased-out copies. Phased-out package copies can be freed while applications that use the package are running. They can also be freed regardless of the INVALIDONLY option.
Start of changeINVALIDONLYEnd of change
Start of changeFree invalid inactive package copies. Invalid package copies cannot be executed by Db2 until they are rebound. Specify INVALIDONLY to remove inactive invalid package copies to reclaim space. This action also enables the original package copy to be repopulated on the next REBIND with PLANMGMT(EXTENDED).
NO
Package copies are freed regardless of whether they are valid. NO is the default value.
YES
Only inactive invalid package copies are freed. An inactive package is invalid if the VALID column of SYSIBM.SYSPACKCOPY table row for the package contains a 'NO' value or the current release does not support packages that were bound under the release in which the package copy was bound.
End of change

Usage notes

Freeing multiple packages
If you free multiple packages with this subcommand, each successful free is committed before freeing the next package.

If an error occurs on a certain package specified explicitly in a list or implicitly with (*), FREE PACKAGE terminates for that package and continues with the next package to be processed.

Freeing trigger packages
Start of changeYou can free package copies for triggers and SQL routines. However, PLANMGMTSCOPE(ALL) is not supported for trigger packages and SQL routines. You must issue a DROP statement for the trigger or SQL routine to free the active package copies.End of change
Trace information for data sharing members
When this command with group scope is issued in a Db2 data sharing member, it also runs on all other active members. IFICID 090 trace records for other group members can show that the same command was issued by the SYSOPR authorization ID from the 016.TLPKN5F correlation ID, in addition to the trace records from the member where the original command was issued. See Command scope in Db2 data sharing.

Examples

Free version newver of the package TEST.DSN8BC81 located at USIBMSTODB22. Generate only warning, error, and completion messages (not informational messages):
FREE PACKAGE (USIBMSTODB22.TEST.DSN8BC81.(
newver
)) FLAG(W)
Free all packages at the local server in the collection named TESTCOLLECTION.
FREE PACKAGE (TESTCOLLECTION.*)
Start of changeFree all inactive package copies for version newver of the package &collid.&name located at &location:End of change
Start of change
FREE PACKAGE (&location.&collid.&name.(newver)) PLANMGMTSCOPE(INACTIVE)
End of change
Start of change Free all ORIGINAL package copies: End of change
Start of change
FREE PACKAGE (*.*.*.(*)) PLANMGMTSCOPE(ORIGINAL)
End of change
Start of changeFree all inactive invalid package copies.End of change
Start of change
FREE PACKAGE (*.*.*.(*)) PLANMGMTSCOPE(INACTIVE) INVALIDONLY(YES)
End of change