Tip

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 first published in May 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.