Assigning stored procedures and functions to WLM application environments

You can assign procedures to WLM environments to route the work that is associated with the procedures to specific address spaces.

About this task

Workload manager routes work to address spaces based on the application environment name and service class associated with the stored procedure or function.

To assign a stored procedures or user-defined functions to run in WLM-established stored procedures address spaces:

Procedure

  1. Make sure a numeric value is specified for the STORTIME subsystem parameter. If you have problems with setting up the environment, this timeout value ensures that your request to execute a stored procedure does not wait for an unlimited amount of time.

    To prevent creating too many address spaces, create a relatively small number of WLM application environments and z/OS® service classes.

  2. Minimize the number of application environments and z/OS service classes. Otherwise, you might cause WLM to create too many WLM address spaces. WLM creates one address space for each combination of application environment and service class. In other words, if five application environments have calling threads, and six service classes exist, WLM might create as many as 30 address spaces.
  3. Use the WLM application environment panels to associate the environment name with the JCL procedure. The following figure shows an example of this panel. For detailed information about workload management panels and how to use them, see Using the WLM ISPF Application .
    Figure 1. WLM panel to create an application environment
    . You can also use the variable &IWMSSNM for the DB2SSN parameter (DB2SSN=&IWMSSNM). This variable represents the name of the subsystem for which you are starting this address space. This variable is useful for using the same JCL procedure for multiple DB2® subsystems.
      Application-Environment  Notes  Options  Help
    ------------------------------------------------------------------------
                        Create an Application Environment
    Command ===> ___________________________________________________________
     
    Application Environment Name . : WLMENV2_____________________  Required
    Description  . . . . . . . . . . Large Stored Proc Env.
    Subsystem Type . . . . . . . . . DB2___  Required
    Procedure Name . . . . . . . . . DSN1WLM
    Start Parameters . . . . . . . . DB2SSN=DB2A,NUMTCB=2,APPLENV=WLMENV2
                                     _______________________________________
                                     ___________________________________
     
    Starting of server address spaces for a subsystem instance:
    1   1.  Managed by WLM
        2.  Limited to a single address space per system
        3.  Limited to a single address space per sysplex
     
  4. Specify the WLM application environment name for the WLM_ENVIRONMENT option of the CREATE or ALTER PROCEDURE (or FUNCTION) statement to associate a stored procedure or user-defined function with an application environment.
  5. Using the installation utility in the WLM application, install the WLM service definition that contains information about this application environment into the couple data set.
  6. Activate a WLM policy from the installed service definition.
  7. Begin running stored procedures.

Recommendations for assigning stored procedures to WLM environments

The NUMTCB value that you choose for each application environment will vary by language. The following table provides general recommendations for the WLM procedure NUMTCB setting for the different language stored procedures. These recommendations are based on available resources and should be tuned accordingly.
Table 1. Recommended types WLM environments to define
Stored procedure name NUMTCB value Comments
COBOL, C/C++, PL/I 10-40  
Debugging COBOL, C/C++ and PL/I related stored procedures 10-40  
REXX 1 REXX stored procedures must run in a WLM procedure with NUMTCB = 1. If they execute in a procedure with NUMTCB>1, unpredictable results, such as an 0C4 will occur.
Java (non-resettable mode) 20-40 Each JVM is started in non-resettable mode and is never reset. This allows you to run many more Java stored procedures.
External SQL stored procedures 10-40 Must have one unauthorized data set. COBOL, C/C++, and PL/I stored procedures can share the same application environment if the STEPLIB data sets and run time options are the same for all languages.