ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

about control job log output api

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • about control job log output api

    i want to control the joblog output, i'd like to use the qmhctljl api to do it
    i set the parm (Number of message filter elements) to zero, everything
    goes well and when i set the parm greater than zero, i always get the
    CPF24D6 error message . i wonder where the problem is ?
    nice to give me an example, thanks for your help .

  • #2
    Re: about control job log output api

    It looks like the field you are changing is reserved
    Code:
     Message ID . . . . . . . . . :   CPF24D6                                       
     Message file . . . . . . . . :   QCPFMSG                                       
       Library  . . . . . . . . . :     QSYS                                        
     Message text . . . . . . . . :   Reserved field in filter element &1 does not c
    ontain a null value.

    I dont think I have an example of this API..

    Code:
    Q:	How can I prevent people from deleting their joblogs?
    
    A:	There has been a lot of good discussion on this topic, but there is one
    solution that has not been mentioned yet. You can use the Control Job Log
    Output (QMHCTLJL) API to cause the job log to be placed into physical files
    instead of being placed into a spooled file. Then by using object authority
    you can prevent users from even reading those physical files. Here is a
    sample CL program that uses this API to do just that.
    
    	PGM
    	DCL       VAR(&FILENAME) TYPE(*CHAR) LEN(65)
    	DCL       VAR(&FORMAT) TYPE(*CHAR) LEN(8) VALUE('CTLJ0100')
    	DCL       VAR(&MSG) TYPE(*CHAR) LEN(30)
    	DCL       VAR(&FILTER) TYPE(*CHAR) LEN(4) VALUE(X'00000000')
    	DCL       VAR(&MSGQ) TYPE(*CHAR) LEN(20) VALUE('*SYSOPR             ')
    	DCL       VAR(&ERROR) TYPE(*CHAR) LEN(256) VALUE(X'00000000')
    	DCL       VAR(&USR) TYPE(*CHAR) LEN(10)
    	DCL       VAR(&NBR) TYPE(*CHAR) LEN(6)
    	RTVJOBA   USER(&USR) NBR(&NBR)
    	CHGVAR    VAR(%BIN(&FILENAME 1 4)) VALUE(65)
    	CHGVAR    VAR(%SST(&FILENAME 5 10))  VALUE('P         ')
    	CHGVAR    VAR(%SST(&FILENAME 6 9)) VALUE(&USR)
    	CHGVAR    VAR(%SST(&FILENAME 15 10)) VALUE('JOBLOG    ')
    	CHGVAR    VAR(%SST(&FILENAME 25 10)) VALUE('JOB       ')
    	CHGVAR    VAR(%SST(&FILENAME 28 6)) VALUE(&NBR)
    	CHGVAR    VAR(%SST(&FILENAME 35 10)) VALUE('S         ')
    	CHGVAR    VAR(%SST(&FILENAME 36 9)) VALUE(&USR)
    	CHGVAR    VAR(%SST(&FILENAME 45 10)) VALUE('JOBLOG    ')
    	CHGVAR    VAR(%SST(&FILENAME 55 10)) VALUE(%SST(&FILENAME 25 10))
    	CHGVAR    VAR(%SST(&FILENAME 65 1)) VALUE('0')
    	CALL      PGM(QSYS/QMHCTLJL) PARM(&FILENAME &FORMAT &MSG &FILTER +
    	            &MSGQ &ERROR)
    	CHGOBJOWN OBJ(JOBLOG/%SST(&FILENAME 5 10)) OBJTYPE(*FILE) +
    	            NEWOWN(______) CUROWNAUT(*REVOKE)
    	RVKOBJAUT OBJ(JOBLOG/%SST(&FILENAME 5 10)) OBJTYPE(*FILE) +
    	            USER(*PUBLIC) AUT(*ALL)
    	CHGOBJOWN OBJ(JOBLOG/%SST(&FILENAME 35 10)) OBJTYPE(*FILE) +
    	            NEWOWN(______) CUROWNAUT(*REVOKE)
    	RVKOBJAUT OBJ(JOBLOG/%SST(&FILENAME 35 10)) OBJTYPE(*FILE) +
    	            USER(*PUBLIC) AUT(*ALL)
    	ENDPGM
    
    Before using the program create library JOBLOG. Also change 'NEWOWN
    (______)' in the above source to change the physical files created into
    that library to be owned by the same user profile that will own the CL
    program. Then create the program while specifying USRPRF(*OWNER). Now,
    after the program is called in a job, if that job produces a job log that
    job log will be placed into two member of two physical files in the JOBLOG
    library. The names of the two physical files will be P and S followed by
    the first 9 characters of the user profile name.
    
    One enhancement that is needed is to have the program send a message
    somewhere that includes the full job name and the names of the physical
    files and the member that will be used for the job log. This should help
    you determine which member to look at.
    
    Thanks to Ed Fishel
    I can look but if someone else does please post

    Thanks
    Jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: about control job log output api

      thank you jamief
      i have tried the cl program, it did well. it comes to my attention that the fourth
      parm ''&filter" was set to x'00000000' , does it mean i must set the parm to zero
      when i use this api ?

      Comment


      • #4
        Re: about control job log output api

        Jack,

        Yes that is hex for *zero.
        and no it doesnt have to be *zeros
        can be 0 thru 255

        You are now the expert as I have not used this program I just
        "found" it for you.


        Code:
        Required Parameter Group:
        
        1 Output file names structure Input Char(65) 
        2 Output file name structure format Input Char(8) 
        3 Message filter array Input Char(*) 
        4 Number of message filter elements Input Binary(4) 
        5 Qualified error message queue name Input Char(20) 
        6 Error code I/O Char(*) 
        
         Default Public Authority: *USE
        i think if parameter 3 is an array then parameter 4 can be greater than
        *zeros ....this is just a guess. It looks like you can exclude messages with
        this array please read below.


        Code:
        Message filter array 
        INPUT; CHAR(*) 
        An array of zero or more elements. Each element in the array defines a test
         applied against each message before it is written to the output file. The 
        tests are performed in the order they appear in the array. A message is 
        rejected and not written to the output file if any one test defined in the 
        array is true for the message. A message is selected and written to the 
        output file if all tests defined in the array are false for the message.
        
        Each array element specifies a message severity, message type, and 
        message ID. If a message has a message severity less than or equal 
        to the specified severity, has the specified type, and has a message 
        ID equal to the specified ID, the test is true and the message is not 
        written to the output file. Processing stops on the rejected message 
        and the next message is processed.
        
        If a message meets one or two of the criteria but not all three, the test 
        is false and the test defined by the next array element is applied. If 
        all array elements have been applied to the message and none have 
        been found true, the message is written to the output file.




        the fourth parameter is
        4 Number of message filter elements BIN(4)
        when defining in RPG use I (intenger) instead of B (binary)
        Code:
        The number of elements in the Message filter array parameter. 
        The value must be greater than or equal to 0 but less than or 
        equal to 255. If no message filtering is to be done during job 
        log production, this parameter must be set to 0.

        If you could please post your source sample when you get it running.

        take care
        Jamie
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: about control job log output api

          in the light of the guide above, i found the error at last
          thank you jamief

          i post the source code below

          Code:
            
              H*  Programe No. :
               H*          Text :
               H*      Function :  control job log  output
               H*
               H*     Programer :
               H*
               H*  Date Created :
               H*                                      
               H************************************
               H*
               H*
               H************************************
               D*                  Err_Code
               DRtnErrorDs       Ds
               D  ErrBytes               1      4B 0 Inz(271)
               D  ErrBytesAva            5      8B 0 Inz(0)
               D  Exception              9     15
               D  Reserved              16     16
               D  Data                  17    271
               D*
               D* QMHCTLJL  parms
               DFileds           Ds            65
               D Lenttt                  1      4B 0 Inz(65)
               D FileName                5     24A   Inz('PLOGFILE  TESTOBJ   ')
               D MemName                25     34A   Inz('PLOGFILE  ')
               D sndFile                35     54A   Inz('FLOGFILE  TESTOBJ   ')
               D sndMem                 55     64A   Inz('FLOGFILE  ')
               D operMem                65     65A   Inz('1')
               DFormat           S              8A   Inz('CTLJ0100')
               DFilterpt         S                   Dim(3)  like(filter)
               DFilter           Ds            28
               D Reserv                  1      4A   Inz(x'00000000')
               D Mesgsever               5      8B 0
               D Mesgtype                9     18A
               D MesgId                 19     25A
               D Reserve                26     28A   Inz(x'000000')
               DNumOfFilter      S             10I 0
               DMessageQ         S             20A
               DPgmDs           SDS
               D PgmMsg                 40     46
               D
               C*---------------------------------------------------------------------
               C                   Eval      Mesgsever  = 30
               C                   Eval      Mesgtype = '*CMD'
               C                   Eval      MesgID = '*ANY'
               
                * when the message  severity is less than 30
                * and  message type is '*cmd',  
                * it will  be reject and not written to the outfile
                
               C                   Eval      Filterpt(1) = Filter
                *
               C                   Eval      Mesgsever  = 30
               C                   Eval      Mesgtype = '*RPY'
               C                   Eval      MesgID = '*ANY'
                * similar to the first condition
                *
               C                   Eval      Filterpt(2) = Filter
               C                   Eval      Mesgsever  = 10
               C                   Eval      Mesgtype = '*INFO'
               C                   Eval      MesgID = '*ANY'
                *
               C                   Eval      Filterpt(3) = Filter
               C                   Eval      NumOfFilter = 3
               C                   Call      'QMHCTLJL'
               C                   Parm                    FileDs
               C                   Parm                    Format
               C                   Parm                    filterpt
               C                   Parm                    NumOfFilter	
               C                   Parm      '*NONE'       MessageQ
               C                   Parm                    RtnErrorDs
               C                   Dsply                   Exception
               C                   exsr      @Exit
               C
               C*---------------------------------------------------------------------
               C     *PSSR         Begsr
               C                   If        PgmMsg <> *Blanks
               C                   Dsply                   Pgmmsg
               C                   Eval      *INLR = *ON
               C                   Return
               C                   EndIf
               C                   Endsr
               C*--------------------------------------------------------------------
               C*
               C*--------------------------------------------------------------------
               C     @Exit         Begsr
               C                   Seton                                          LR
               C                   Return
               C                   Endsr

          Comment


          • #6
            Re: about control job log output api

            Great job --- code looks very clean..

            Thank you for posting


            Hope to see more from you...

            Jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: about control job log output api

              i want know about the CALLP and CALLB
              whats the different between CALLP and CALLB

              please help me

              Comment

              Working...
              X