In a CA Ideal application, you can set a new plan name in place of the default plan name. The PDL function $PLAN sets a plan name or returns the plan name most recently set in the application.
If a plan name was not set in the application, the function returns the name set for the session. If a name was not set for the session, the function returns IDP140DV. It does not return a value set in a plan name exit (described next).
You can use $PLAN with a SET statement to set a new CA Ideal plan name for the application, for example:
SET $PLAN = 'INVPLAN'
Note: You can execute the SET $PLAN statement only before the first SQL statement in a logical unit of work. That is, executing SET $PLAN at any point except before the first SQL statement at the beginning of a CICS transaction or following a database Commit causes a runtime error.
The first SQL statement can be embedded SQL, SQL generated by a FOR construct for a DB2 dataview, or SQL in a non-Ideal subprogram. A Commit can be a CHECKPOINT, a BACKOUT statement, or an SQL COMMIT or ROLLBACK statement.
The new plan takes effect when the exit is called at the next SQL statement. For more information about $PLAN, see the Programming Reference Guide.
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 to use 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.
|
|