× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Jay

If you're using SEU for creating and modifying source, whether it's
through the STRSEU command, via PDM or a CMS tool, then you can use the
following to log all accesses to SEU and determine how long a source
member was being "maintained" for:

1) Create a duplicate copy of the STRSEU command in your QGPL library:

     CRTDUPOBJ OBJ(STRSEU) FROMLIB(QSYS) OBJTYPE(*CMD) TOLIB(QGPL)


2) Rename the original STRSEU command in QSYS and QPDA to something like

   IBMSTRSEU:

     RNMOBJ OBJ(QSYS/STRSEU) OBJTYPE(*CMD) NEWOBJ(IBMSTRSEU)
     RNMOBJ OBJ(QPDA/STRSEU) OBJTYPE(*CMD) NEWOBJ(IBMSTRSEU)

   At this point, the STRSEU command will still work as it picks up the 
   version within your QGPL library.  There are also versions of the
STRSEU 
   command within the compatibility libraries; QSYSV4R4M0, QSYSV4R5M0,
etc 
   which we do not need to rename as they are not usually within the
library 
   list.


3) Enter and compile the source for the following physical file
(SEULOG):

     A*****************************************************************
     A*          C O M P I L E R   I N S T R U C T I O N S           **
     A*****************************************************************
     A* <compiler>                                                   **
     A*   <cmd>                                                      **
     A*     CRTPF FILE(QGPL/SEULOG)                                  **
     A*            SRCFILE(library/QDDSSRC)                          **
     A*            SRCMBR(SEULOG)                                    **
     A*            TEXT('SEU Usage Log')                             **
     A*   </cmd>                                                     **
     A* </compiler>                                                  **
     A*****************************************************************
     A          R SEULOGR                                              
     A*                                                                
     A            USER          10A         TEXT('User ID')            
     A            JOB           10A         TEXT('Job Name')           
     A            JOBNO          6A         TEXT('Job No')             
     A*                                                                
     A            SEUOPT         1A         TEXT('Option')             
     A*                                                                
     A            SRCFIL        10A         TEXT('Source File')        
     A            SRCLIB        10A         TEXT('Source Library')     
     A            SRCMBR        10A         TEXT('Source Member')      
     A            SRCTYP        10A         TEXT('Source Type')        
     A            SRCTXT        50A         TEXT('Source Text')        
     A*                                                                
     A            STRDAT          L         TEXT('Start Date')         
     A                                      DATFMT(*ISO)               
     A            STRTIM          T         TEXT('Start Time')         
     A                                      TIMFMT(*ISO)               
     A*                                                                
     A            ENDDAT          L         TEXT('End Date')           
     A                                      DATFMT(*ISO)               
     A            ENDTIM          T         TEXT('End Time')
     A                                      TIMFMT(*ISO)    
     A*                                                     
     A          K STRDAT                                    
     A          K STRTIM                                    
     A          K USER                                      
     A          K JOB                                       
     A          K JOBNO                                     

   This physical file will hold details of which source
file/library/member 
   was used by SEU and also record the start and end times that the
member 
   was maintained.


4) Now enter and compile the following RPG ILE program (SEULOG) which
will 
   be used to log which source member is being maintained, and to call
the 
   IBMSTRSEU command:

     ******************************************************************
     **          C O M P I L E R   I N S T R U C T I O N S           **
     ******************************************************************
     ** <compiler>                                                   **
     **   <cmd>                                                      **
     **     CRTBNDRPG PGM(QGPL/SEULOG)                               **
     **               SRCFILE(library/QRPGLESRC)                     **
     **               SRCMBR(SEULOG)                                 **
     **               DFTACTGRP(*NO)                                 **
     **               REPLACE(*YES)                                  **
     **   </cmd>                                                     **
     ** </compiler>                                                  **
     ******************************************************************
     H DatFmt(*YMD) Option(*NoDebugIo:*SrcStmt)                        
                                                                       
     ******************************************************************
     **               F I L E   D E F I N I T I O N S                **
     ******************************************************************
                                                                       
     FSeuLog    UF A E           K Disk                                
      * SEU Usage Log File                                             
                                                                       
     ******************************************************************
     **               D A T A   D E F I N I T I O N S                **
     ******************************************************************
                                                                       
      * Program Status Data Structure                                  
     D PgmDs          SDS                                              
     D  CurJob               244    253a                               
     D  CurUser              254    263a                               
     D  CurJobNo             264    273a                               
                                                                       
      * Qualified Source File Name Segments                            
     D QualSrcFile     DS                                              
     D  qSrcFil                      10a                               
     D  qSrcLib                      10a                               
                                                                       
      * Work fields                                                    
     D Quote           c                   Const('''')                 
                                                                       
     D Cmd             s          32767a                               
     D NewCmd          s          32767a                               
     D NewCmdLen       s             10i 0                             
                                                                       
     ******************************************************************
     **          P R O T O T Y P E   D E F I N I T I O N S           **
     ******************************************************************
                                                                       
      * Program Entry Parameters                                       
     D EntryParms      Pr                  ExtPgm('SEULOG')            
     D  p1SrcFil                     20a   Const                       
     D  p1SrcMbr                     10a   Const                       
     D  p1SrcTyp                     10a   Const                       
     D  p1SeuOpt                      1a   Const                       
     D  p1Text                       50a   Const                       
                                                                       
      * Process Command (QCAPCMD) API                                  
     D RunCmd          Pr                  ExtPgm('QCAPCMD')           
     D  CmdStr                    32767a   Const Options(*VarSize)     
     D  CmdStrLen                    10i 0 Const                       
     D  CmdCtlBlk                 32767a   Const Options(*VarSize)     
     D  CmdCtlBlkLen                 10i 0 Const                       
     D  CmdCtlBlkFmt                  8a   Const                       
     D  NewCmdStr                 32767a   Options(*VarSize)           
     D  NewCmdStrAvl                 10i 0 Const                       
     D  NewCmdStrLen                 10i 0                             
     D  ApiErrCode                         Like(ApiError)              
                                                                      
     D EntryParms      Pi                                             
     D  p1SrcFil                     20a   Const                      
     D  p1SrcMbr                     10a   Const                      
     D  p1SrcTyp                     10a   Const                      
     D  p1SeuOpt                      1a   Const                      
     D  p1Text                       50a   Const                      
                                                                      
     D CPOP0100        Ds                                             
     D  capPrcType                   10i 0 Inz(0)                     
     D  capDBCS                       1a   Inz('0')                   
     D  capPrompt                     1a   Inz('0')                   
     D  capSyntax                     1a   Inz('0')                   
     D  capMsgKey                     4a                              
     D  capReserved                   9a   Inz(*Allx'00')             
                                                                      
     D ApiError        DS                                             
     D   ApiBytes                    10I 0 Inz(%Size(ApiError))        
     D   ApiBytesOut                 10I 0                             
     D   ApiErrID                     7A                               
     D   ApiReserved                  1A                               
     D   ApiErInDta                 256A                               
                                                                       
     ******************************************************************
     **                      K E Y   L I S T S                       **
     ******************************************************************
                                                                       
      * SEU Usage Log                                                  
     C     SeuLogKey     KList                                         
     C                   KFld                    STRDAT                
     C                   KFld                    STRTIM                
     C                   KFld                    USER                  
     C                   KFld                    JOB                   
     C                   KFld                    JOBNO                 
                                                                       
     ******************************************************************
     **     C A L C U L A T I O N   S P E C I F I C A T I O N S      **
     ******************************************************************
                                                                       
      * Identify the SEU start time and create a record on the SEU     
      * Usage Log...                                                   
     C                   Time                    StrDat                
     C                   Time                    StrTim                
                                                                       
     C                   Eval      Job    = CurJob                     
     C                   Eval      User   = CurUser                    
     C                   Eval      JobNo  = CurJobNo                   
                                                                       
      * Chain to and create the log record...                          
     C     SeuLogKey     Chain(e)  SeuLog                              
     C                   Eval      SrcFil = p1SrcFil                   
     C                   EvalR     SrcLib = p1SrcFil                   
     C                   Eval      SrcMbr = p1SrcMbr                   
     C                   Eval      SrcTyp = p1SrcTyp                   
     C                   Eval      SeuOpt = p1SeuOpt                   
     C                   Eval      SrcTxt = p1Text                     
                                                                       
     C                   Write     SeuLogR                             
      * Build the SEU command string, using the renamed IBMSTRSEU
command...
     C                   Eval      Cmd = 'IBMSTRSEU SRCFILE('          
                                                                       
     C                   If        SrcFil = '*SAME'                    
     C                   Eval      Cmd = %Trim(Cmd) + '*SAME)'         
     C                   Else                                          
     C                   Eval      Cmd = %Trim(Cmd) + %Trim(SrcLib) +  
     C                               '/' + %Trim(SrcFil) + ')'         
     C                   EndIf                                         
                                                                       
     C                   Eval      Cmd = %Trim(Cmd) + ' SRCMBR(' +     
     C                               %Trim(SrcMbr) + ') TYPE(' +       
     C                               %Trim(SrcTyp) + ') OPTION('       
                                                                       
     C                   If        SeuOpt = *Blanks                    
     C                   Eval      Cmd = %Trim(Cmd) + Quote + ' ' +    
     C                               Quote + ') TEXT('                 
     C                   Else                                          
     C                   Eval      Cmd = %Trim(Cmd) + %Trim(SeuOpt) +  
     C                               ') TEXT('                         
     C                   EndIf                                         
                                                                       
     C                   If        SrcTxt <> '*SAME'                   
     C                   Eval      Cmd = %Trim(Cmd) + Quote +          
     C                               %Trim(SrcTxt) + Quote + ')'       
     C                   Else                                          
     C                   Eval      Cmd = %Trim(Cmd) + '*SAME)'         
     C                   EndIf                                         
                                                                      
      * Now run the command...                                        
     C                   CallP     RunCmd(%Trim(Cmd)       :          
     C                                    %Len(%Trim(Cmd)) :          
     C                                    CPOP0100         :          
     C                                    %Len(CPOP0100)   :          
     C                                    'CPOP0100'       :          
     C                                    NewCmd           :          
     C                                    32767            :          
     C                                    NewCmdLen        :          
     C                                    ApiError)                   
                                                                      
      * When SEU completes, log the completion time...                
     C     SeuLogKey     Chain(e)  SeuLog                             
                                                                      
     C                   Time                    EndDat               
     C                   Time                    EndTim               
                                                                      
     C                   Update    SeuLogR                            
                                                                      
      * Finally exit the program...                                   
     C                   Eval      *InLr = *On                        
     C                   Return                                       

   Note, for this program we're not checking that SEU completes
successfully 
   And are assuming that the appropriate record will be retrieved during
the 
   Update portion of the program.


5) Change the command processing program for the STRSEU command in QGPL
to 
   use program SEULOG in QGPL.  Remember, you still have the original 
   command renamed as IBMSTRSEU.

     CHGCMD CMD(QGPL/STRSEU) PGM(QGPL/SEULOG)


Now, whenever one of your programmers uses SEU to maintain their source
code 
a log will be made in the SEULOG file and this can be analysed using 
whatever method you prefer.

If you're not happy renaming the IBM supplied command, you can always
create 
a copy in your own system level library (e.g. MYSYSLIB) and ensure that
the QSYSLIBL system value has MYSYSLIB above QSYS in the library list.
If you do it this way, don't forget to use QSYS/STRSEU in the "Cmd"
variable within 
the ILE program.

Hope it helps

All the best

Jonathan
www.astradyne-uk.com


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of jns
Sent: 20 May 2005 16:17
To: midrange-l@xxxxxxxxxxxx
Subject: Programmer activity tool

Hello, I would like to track through the system, exactly what
programmers are doing, on a daily basis. I would like to see, what
programs they worked on. Has anyone any code they could share? or if
not, what is the best way to write such a tool.
Thank you,
Jay


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.