I am looking for projects to work on
Please contact with me at!

Wednesday, January 19, 2011

Some notes about QSQSRVR job on IBM i5 OS V5R4

QSQSRVR runs in subsystem QSYSWRK. But, with "V5R4 PTF—SI33298" or "V6R1 PTF—SI33949", it is possible to configure QSQSRVR to run in different subsystem. I copied some commands here for my convenience.

There are two ways to request to use SQL Server Mode in programm. One is, in SQL CLI API, call SQLSetEnvAttr() via the SQL_ATTR_SERVER_MODE attribute. The other is using QWTCHGJB() Work Management API, via the "Server mode for Structured Query Language" key 1922 within the JOBC0200 format.

By default, five QSQSRVR jobs are active. Two more QSQSRVR jobs will be created if fewer than jobs are unused. The following command is to increase the initial number of jobs, threshold, and job number increasing interval.

Management Central starts 18 SQL Server Mode connections. Each of the two servers (QYPSSRV and QYPSJSVR) currently establishes nine connections with a QSQSRVR job to process its SQL requests to these databases. The following commands are used to find the controlling job:

2)Or using iNavigator: Work Management --> Subsystem --> Active Subsystems --> Qsyswrk

In order to run QSQSRVR job in same subsystem as application runs, we need to do following steps,

1)install PTF—SI33298 for i5 OS V5R4 or PTF—SI33949 for i5 OS V6R1. Use command WRKPTFGRP to list all installed PTF.

2) set environment variable QIBM_SRVRMODE_SBS to be "*SAME" or "". Here is the command to add this environment variable, ADDENVVAR ENVVAR(QIBM_SRVRMODE_SBS) VALUE('*SAME') LEVEL(*SYS). To remove environment variable, command RMVENVVAR is used.

Finally, can I use this to optimize Web application running inside Zend server? It seems I can not because the QIBM_SRVRMODE_SBS environment variable is ignored whenever the name of the application subsystem is 'QHTTPSVR' or 'ZEND'. However, this environment variable should be seen in subsystem where application use native JDBC driver to connect to DB2. PHP db2 extension and native JDBC driver (in IBM Java toolkit) connect to DB2 through DB2 SQL server mode. Using DB2 SQL Server Mode, each connection has a QSQSRVR job. QSQSRVR job inherits attributes user profile and running priority from connection request initializing.

1) DB2 for i5/OS: SQL Server Mode Primer
2) TechTip: Grab Control of the DB2 QSQSRVR Jobs


  1. Hi, a question ..How i end this jobs ...?

  2. Thanks, liked your article!

    FYI PTF SI48797 changes the impact of QIBM_SRVRMODE_SBS, so that ZEND and QHTTPSVR subsystems are no longer ignored.

    1. Thank you for information! I think it will be very helpful for adminitrator to identify which app is a greedy one. Put QSQSRVR job under same subsystems where zend server runs should be helpful for memory pool management.
      I dont have access to iSeries platform now. But, still many thanks!