News Stay informed about the latest enterprise technology news and product updates.

Track users logged onto the system -- code

Track users logged onto the system -- code

      *  Create User Space API Parameters                              
     DSpaceName        S             20A   Inz('LISTJOB   QTEMP     ') 
     DSpaceAttrib      S             10A                               
     DSpaceSize        S             10I 0 Inz(1024)                   
     DSpaceInit        S              1A                               
     DSpaceAuth        S             10A   Inz('*ALL')              
     DSpaceText        S             50A                               
     DSpaceReplace     S             10A   Inz('*YES')                 
      *  Change User Space Attribute API Parameters                 
     DSpaceLibOut      S             10A                            
     DSpaceChgAtt      DS                                           
     D  NbrAttrib                    10I 0 Inz(1)                   
     D  KeyAttrib                    10I 0 Inz(3)                   
     D  SizeAttrib                   10I 0 Inz(%Size(DataAttrib))   
     D  DataAttrib                    1A   Inz('1')                 
      *  List Jobs API Parameters (REQUIRED)                           
     DJobLFormat       S              8A   Inz('JOBL0200')             
     DJobLJobName      S             26A   Inz('*ALL      *ALL      *ALL  ') 
     DJobLStatus       S             10A   Inz('*ALL      ')           
      *  List Jobs API Parameters (OPTIONAL GROUP 2)            
     DJobLType         S              1A   Inz('I')             
     DJobL#Fields      S             10I 0 Inz(%Elem(JobLKeys)) 
     DJobLKeys         S             10I 0 Dim(5)               
      *  Common List API Header                             
     DAPIHeader0100    DS                  Based(SpacePtr)  
     D  HdrUserArea                  64A                    
     D  HdrSize                      10I 0                  
     D  HdrRelease                    4A                    
     D  HdrFormat                     8A                    
     D  HdrAPIName                   10A                    
     D  HdrDateTime                  13A                    
     D  HdrInfoSts                    1A                    
     D  HdrUsrSpcSize                10I 0                  
     D  HdrOffInp                    10I 0                  
     D  HdrSizeInput                 10I 0                  
     D  HdrOffHdr                    10I 0                  
     D  HdrSizeHdr                   10I 0                  
     D  HdrOffList                   10I 0                  
     D  HdrSizeList                  10I 0                  
     D  HdrList#                     10I 0                  
     D  HdrListSize                  10I 0                  
     D  HdrCCSID                     10I 0                  
     D  HdrCountry                    2A                    
     D  HdrSubset                     1A                   
     D  HdrReserved                  42A                   
      *  API Format JOBL0200 Structure                     
     DFmtJOBL0200      DS                  Based(ListPtr)  
     D  JLJobName                    10A                   
     D  JLJobUser                    10A                   
     D  JLJob#                        6A                   
     D  JLIntJobID                   16A                   
     D  JLStatus                     10A                   
     D  JLJobType                     1A                   
     D  JLJobSubType                  1A                   
     D  JLReserved1                   2A                   
     D  JLJobInfoSts                  1A                   
     D  JLReserved2                   3A                   
     D  JL#Fields                    10I 0                 
      *  Key Value: 0501 Ending severity                       
     D  JLKey1Len                    10I 0                     
     D  JLKey1                       10I 0                     
     D  JLKey1Type                    1A                       
     D  JLKey1Reserve                 3A                       
     D  JLKey1DataLen                10I 0                     
     D  JLEndSeverity                10I 0                     
      *  Key Value: 0401 Date & Time job became active         
     D  JLKey2Len                    10I 0                     
     D  JLKey2                       10I 0                     
     D  JLKey2Type                    1A                       
     D  JLKey2Reserve                 3A                       
     D  JLKey2DataLen                10I 0                     
     D  JLCentury                     1A                       
     D  JLyymmdd                      6A                       
     D  JLhhmmss                      6A                       
     D  JLFiller3                     3A                       
      *  Key Value: 0402 Date & Time job entered system        
     D  JLKey3Len                    10I 0                   
     D  JLKey3                       10I 0                   
     D  JLKey3Type                    1A                     
     D  JLKey3Reserve                 3A                     
     D  JLKey3DataLen                10I 0                   
     D  JLCentury3                    1A                     
     D  JLyymmdd3                     6A                     
     D  JLhhmmss3                     6A                     
     D  JLFiller4                     3A                     
      *  Key Value: 0403 Date & Time job scheduled to run    
     D  JLKey4Len                    10I 0                   
     D  JLKey4                       10I 0                   
     D  JLKey4Type                    1A                     
     D  JLKey4Reserve                 3A                     
     D  JLKey4DataLen                10I 0                   
     D  JLScdateTm                    8A                     
     D  JLFiller5                     8A                     
      *  Key Value: 0404 Date & Time job put on this queue  
     D  JLKey5Len                    10I 0                  
     D  JLKey5                       10I 0                  
     D  JLKey5Type                    1A                    
     D  JLKey5Reserve                 3A                    
     D  JLKey5DataLen                10I 0                  
     D  JLPQdateTm                    8A                    
     D  JLFiller6                     8A                    
      *  Common API Error Structure                               
     DAPIErrorDS       DS                                         
     D  APIBytes                     10I 0 Inz(%Size(APIErrorDS)) 
     D  APIBytesOut                  10I 0                        
     D  APIErrID                      7A                          
     D  APIReserved                   1A                          
     D  APIErInDta                  256A                          
     DSpacePtr         S               *                          
     DListPtr          S               *                          
     DNumList          S              9  0                        
...   *
...   * Do some stuff here
...   *
     C                   Call      'QUSCRTUS'                  
     C                   Parm                    SpaceName     
     C                   Parm                    SpaceAttrib   
     C                   Parm                    SpaceSize     
     C                   Parm                    SpaceInit     
     C                   Parm                    SpaceAuth     
     C                   Parm                    SpaceText     
     C                   Parm                    SpaceReplace  
     C                   Parm                    APIErrorDS    
      *  Change User Space to be extendible                    
     C                   Call      'QUSCUSAT'                  
     C                   Parm                    SpaceLibOut   
     C                   Parm                    SpaceName     
     C                   Parm                    SpaceChgAtt   
     C                   Parm                    APIErrorDS    
      *  List job information entries to user space.           
     C                   Eval      JobLKeys(1) = 0501          
     C                   Eval      JobLKeys(2) = 0401          
     C                   Eval      JobLKeys(3) = 0402          
     C                   Eval      JobLKeys(5) = 0404 
     C                   Call      'QUSLJOB'                  
     C                   Parm                    SpaceName    
     C                   Parm                    JobLFormat   
     C                   Parm                    JobLJobName  
     C                   Parm                    JobLStatus   
     C                   Parm                    APIErrorDS   
     C                   Parm                    JobLType     
     C                   Parm                    JobL#Fields  
     C                   Parm                    JobLKeys     
      *  Get a pointer to the user space                            
     C                   Call      'QUSPTRUS'                       
     C                   Parm                    SpaceName          
     C                   Parm                    SpacePtr           
     C                   Parm                    APIErrorDS         
      *  Set position to first list entry                           
     C                   Eval      Listptr = SpacePtr + HdrOffList  
     C                   Do        HdrList#      NumList 
     C                   exsr      getjoblist            
     C                   if        (JLJobtype = 'I') and 
     C                             (jlstatus = '*ACTIVE')
...   * Do some more stuff here
     C                   EndDo 
...   * Clean up and exit 

Dig Deeper on iSeries system performance and monitoring

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.