MainframeSupports
tip week 2/2009:

When I have logged on to a MVS system I sometimes need to know which DB2 subsystems are available on this MVS. Previously I did this by using SDSF or SYSVIEW and display the active tasks matching the filter *DBM1. It works and if you know about MVS control block structures for active tasks you may produce the list using a program, but it is a bit clumsy. This solution has also the disadvantage of being unable to show you which data sharing group the different DB2 subsystems belong to.

Fortunately all this information is available in storage if you know where to look and how the information is linked together. It took me some time to figure out, but here is the result. I have coded my program in PL/I. If you prefer another programming language you will have to perform the required translation yourself. Let me start with the necessary declarations:

DCL max_address CHAR(4) INIT('80000000'X);
DCL psa_address CHAR(4) INIT('00000000'X);
DCL psa_pointer POINTER BASED(ADDR(psa_address));
DCL 1 psa BASED(psa_pointer)
  , 2 filler CHAR(16)
  , 2 cvt_pointer POINTER
  ;
DCL 1 cvt BASED(psa.cvt_pointer)
  , 2 filler1 CHAR(296)
  , 2 jesct_pointer POINTER
  , 2 filler2 CHAR(40)
  , 2 sysname CHAR(4)
  ;
DCL 1 jesct BASED(cvt.jesct_pointer)
  , 2 filler CHAR(24)
  , 2 ssct_start POINTER
  ;
DCL pointer_char CHAR(4);
DCL pointer_value POINTER BASED(ADDR(pointer_char));
DCL ssct_pointer POINTER;
DCL 1 ssct BASED(ssct_pointer)
  , 2 filler1 CHAR(4)
  , 2 ssct_next POINTER
  , 2 ssid CHAR(4)
  , 2 flag1 CHAR(1)
  , 2 filler2 CHAR(3)
  , 2 ssvt_pointer POINTER
  , 2 erly_pointer POINTER
  ;
DCL 1 erly BASED(ssct.erly_pointer)
  , 2 filler1 CHAR(4)
  , 2 eyecatcher CHAR(4)
  , 2 db2ssid CHAR(4)
  , 2 filler2 CHAR(36)
  , 2 asid FIXED BIN(15)
  , 2 filler3 CHAR(42)
  , 2 productid CHAR(9)
  , 2 filler4 CHAR(19)
  , 2 groupname CHAR(4)
  ;

A DB2 subsystem has to be defined as a MVS subsystem in order to run on a MVS system. All subsystems on a MVS are defined in the SSCT (SubSystem Control Table). The PSA, CVT and JESCT are areas which you have to traverse in order to get to the SSCT. In the SSCT there is a pointer to the socalled ERLY which I do not quite understand the use of except it contains the name of the data sharing group and identifies the MVS subsystem as being a DB2 subsystem. The following code shows you how to navigate the above areas:

PUT SKIP LIST('MVS-NAME=' !! cvt.sysname);
ssct_pointer = jesct.ssct_start;
DO WHILE(ssct_pointer ^= psa_pointer);
  pointer_value = ssct.ssvt_pointer;
  IF pointer_char > psa_address & pointer_char < max_address
   & ssct.flag1 = '00'X
  THEN DO;
    pointer_value = ssct.erly_pointer;
    IF pointer_char > psa_address & pointer_char < max_address
    THEN
      IF erly.eyecatcher = 'ERLY'
      THEN
        IF erly.productid = '5740XYR01'
        THEN
          IF erly.asid = 0
          THEN
            PUT SKIP LIST('DB2: ' !! erly.db2ssid !! ' inactive
                         !! ' (groupname ' !! erly.groupname
                         !! ').'
                         );
          ELSE
            PUT SKIP LIST('DB2: ' !! erly.db2ssid !! ' running '
                         !! ' (groupname ' !! erly.groupname
                         !! ').'
                         );
  END;
  ssct_pointer = ssct.ssct_next;
END;

I cannot guarantee that the above code works on your MVS, because the information in the SSCT is not standardised. The fields in the SSCT prior to the ssvt_pointer must conform to certain rules but the ssvt_pointer and the following fields are defined by the subsystem. This is the reason why I validate the ssvt_pointer and erly_pointer against the address range of MVS. Before I introduced these validations my program abended on some MVS systems.

After the first successful execution of the above code I was surprised to see that a lot of DB2 subsystems which I had never heard of were defined as subsystems without being active. You may experience the same situation. On the other hand you are able to find the active ones which is far more interesting. If the groupname field is blank the DB2 subsystem is not connected to any data sharing group. You may use the product id to find out which version of DB2 the subsystem belongs to when you are running version 6, 7 or 8, but I do not know if it works for DB2 9.

Previous tip in english        Sidste danske tip        Tip list