$PLAN returns the application plan name most recently set in an application. You can use the SET $PLAN statement to specify a logical identifier for the next plan to use. This is a logical identifier, not necessarily the actual plan name. This level of indirection lets you avoid hard coding actual plan names in your programs (which requires compilation for any change to plan names).
This function has the following format:
$PLAN
As the source of a SET statement or in a condition, $PLAN returns the plan name most recently set in a CA Ideal application.
As the target of a SET statement, you can use $PLAN to select a plan name that can instruct DB2 to change to a new plan. You can set $PLAN to any one‑ to eight‑character plan identification or to the name of a field that contains a plan identification.
If $PLAN is set to an alphanumeric literal, you must surround the value with double or single quotes (“ or '). For example:
SET $PLAN = 'PAYPLAN'
Online, CA Ideal applications can switch plan names only if DB2 Version 2 is installed and the RCT entry for the current transaction ID specifies PLNEXIT=YES and PLNPGME=@IADRCTX, the RCT exit CA Ideal supplies.
In batch, CA Ideal applications can switch plans under either release of DB2.
For more information about selecting plans in CA Ideal and setting up the RCT, see the Administration Guide.
IF $PLAN = 'PAYPLAN' …
Examples
This code selects PAYPLAN as the CA Ideal application's plan name for the embedded SQL that follows it.
CHECKPOINT SET $PLAN = 'PAYPLAN' EXEC SQL …END‑EXEC …
The following procedure saves the plan name that was selected in a previous procedure in a working data field SAV‑PLAN. It sets GETPLAN as the plan name used with the FOR construct that follows it, commits its database modifications, and resets the plan name before returning.
<<GET>> PROCEDURE SET SAV‑PLAN = $PLAN SET $PLAN = GETPLAN FOR EACH DB2‑DVW …ENDFOR CHECKPOINT SET $PLAN = SAV‑PLAN ENDPROC
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|