开发者

DB2 Z/os Native SQL Procedures -- Updated

I'm implementing a DB2 Native SQL procedure. It's the first we've tried this in this shop. I've attached the code below. What this routine does is keep track of the number of new records added to a table by time. Whenever it fires, it either updates a record in the monitoring table or inserts a record if the table doesn't exist.

Native procedures are new to Z/os db2 version 9.

The redbook on procedures for Z/os db2 v9 reads: "Figure 15-15 depicts the DB2 compon开发者_StackOverflow中文版ents involved when a native SQL procedure is called either from a remote application, a DB2 attached program, or an allied address space respectively. As illustrated, the SQL statements are no longer executed in an external WLM address space but natively in the database system services address space. For execution, the procedure packages are loaded into the EDM pool."

Yet, If I remove the line "WLM ENVIRONMENT FOR DEBUG MODE DSNDSPENV" from the code, I get an error saying the "WLM Environment must be specified".

Does anyone know a reason that WLM dependency might exist with this code? Do I need to override a WLM_ENVIRONMENT default? And if so, how would I do that?


New Information--------------------------------------------------------


It appears that if you add the option "DISABLE DEBUG MODE" you are not required to specify a WLM for DEBUG.

What's the downside of disabling debug mode? Is there any downside to leaving a procedure in "ALLOW DEBUG MODE"? Is there overhead to using a procedure in which debug can be allowed?


--#SET TERMINATOR !                                            
 CREATE PROCEDURE $172.VQT_QUOTE_INFO_COUNT_NEW_QUOTE(
                      IN RATING_STATE CHAR(2),
                      IN INSERT_TIMESTAMP TIMESTAMP)
 LANGUAGE SQL
 ALLOW DEBUG MODE
 WLM ENVIRONMENT FOR DEBUG MODE DSNDSPENV                 
 BEGIN
   DECLARE NO_RECORD_UPDATED INT DEFAULT 0;
   DECLARE CONTINUE HANDLER FOR SQLSTATE '02000'
      SET NO_RECORD_UPDATED = 1;
  UPDATE  $172.VKT_MONITORING_COUNTS
     SET MC_QUOTE_CNT = MC_QUOTE_CNT + 1
  WHERE MC_STATE_ABBREV = RATING_STATE AND
        MC_SAMPLE_DATE = DATE(INSERT_TIMESTAMP) AND
        MC_SAMPLE_HOUR = HOUR(INSERT_TIMESTAMP);
  IF NO_RECORD_UPDATED = 1    THEN
  INSERT INTO $172.VKT_MONITORING_COUNTS (
              MC_STATE_ABBREV, MC_SAMPLE_DATE, MC_SAMPLE_HOUR,
              MC_QUOTE_CNT, MC_NEW_POLICY_CNT)            
         VALUES.                                                
              (RATING_STATE, DATE(INSERT_TIMESTAMP),
               HOUR(INSERT_TIMESTAMP),  1, 0);               
 END IF;
 END.#
--#SET TERMINATOR ;               


WLM stands for Work Load Manager.

The work load manager (which is part of the base z/OS) is responsable for allocating memory and other resources and running your script.

Each WLM environment will run scripts at different priorities and have its own settings for maximum time to run, maximum cpu consumption and its own set of rules about which resources can be accessed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜