Lists real connected ODBC users

LISTJOBS is a WRKACTJOB complement. This utility helps you to find user connected under the generic QUSER QZDASOINIT job. The output can be shown with dspjoblog. It's necessary for the ILE/C compilator.


/* PROGRAM: LISTJOBS */

 #include 
 
  
#include 
  
   
#include 
   
     
#include 
    
     
#include 
     
      
#include 
      
        
#include 
       
        
#include 
        
         
#include 
         
          
#include 
          
           
#include 
            
           
          
         
        
       
      
     
    
   
  
 
 Qus_Generic_Header_0100_t *space;
char *list_section;

typedef _Packed struct Qus_JOBL0200_ext            
{
    Qus_JOBL0200_t Job0200;

    Qus_Ljob_Key_Fields_t Key_Field_One;
    char User[10];
    char reser1[2];

    Qus_Ljob_Key_Fields_t Key_Fields_Two;
    char jobStatus[4];
} Qus_JOBL0200E_t;

Qus_JOBL0200E_t *entry_list;


/* PARMS FOR QUSCRTUS */
  char spc_name[20];
  char ext_atr[10];
  int  initial_size;
  char initial_value[1];
  char auth[10];
  char desc[50];
  char replace[10];

/* MISCELLANEOUS VARIABLES */
  int count;
  Qus_EC_t err_code;
  char msgTxt[256];


/* MAIN FUNCTION */
void main(int argc,char** argv)
{
    int l;
    int keys[2]={305, 101};
    _INT4 kk=1;
    _FEEDBACK pp;

    strcpy(spc_name,
           "RTVUSLJOBFQTEMP     ");
    memset(ext_atr,' ',10);
    initial_size = 1024;
    strcpy(initial_value," ");
    strcpy(auth,"*CHANGE   ");
    memset(desc,' ',50);
    strcpy(replace,"*YES      ");

    err_code.Bytes_Provided = 0;
    QUSCRTUS(spc_name,
           ext_atr,
           initial_size,
           initial_value,
           auth,
           desc,
           replace,
           &err_code);

    QUSLJOB(spc_name,
          "JOBL0200",
          "QZDASOINITQUSER     *ALL  ",
          "*ACTIVE   ",
          &err_code,
          "*",
          2,
          keys);

    QUSPTRUS(spc_name,
             &space,
             &err_code);
    list_section = (char *)space;
    list_section = list_section +
             space->Offset_List_Data;
    entry_list = (Qus_JOBL0200E_t*)list_section;
    count = 1;

    sprintf( msgTxt, 
"   JOB     USER       NBR    CONNECTED  Status" );
    CEEMOUT( msgTxt, &kk, &pp );
    sprintf( msgTxt, 
"========== ========== ====== ========== ======" );
    CEEMOUT( msgTxt, &kk, &pp );
    while( count <= space->Number_List_Entries ){
          if( memcmp( entry_list->User, "QUSER", 4 ) ){
              sprintf( msgTxt, "%10.10s %10.10s %6.6s %10.10s %4.4s",
                  entry_list->Job0200.Job_Name_Used,
                  entry_list->Job0200.User_Name_Used,
                  entry_list->Job0200.Job_Number_Used,
                  entry_list->User,
                  entry_list->jobStatus );
                CEEMOUT( msgTxt, &kk, &pp );
            }
            count++;
            entry_list++;
        }
    }
    QUSDLTUS(spc_name, &err_code);
} 
This was last published in May 2001

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close