ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Submitted job auto cancelling

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

  • Submitted job auto cancelling

    I have a CLLE program which I submit which calls various other programs. My problem is if one of these programs fails the whole job is cancelled. How can I make it go into MSGW with CDIR?

    Here is an example from last night DSPLOG. All the programs are CLLE. The first program failed with CPYF ended in error and then the other programs in the stack automatically cancelled ultimately ending my C50SAVACT job.. How to I fix this? Is it a problem with the programs or how it is submitted?

    CPF2817 received by procedure SDCJD. (C D I R)
    CPF2817 received by procedure SDCJD. (C D I R)
    C
    CEE9901 received by procedure SDCJREC. (C D I R)
    CEE9901 received by procedure SDCJREC. (C D I R)
    C
    CEE9901 received by procedure C50SAVACT. (C D I R)
    CEE9901 received by procedure C50SAVACT. (C D I R)
    C
    Job 782705/MYOUNUS/C50SAVACT ended on 13/01/14 at 02:15:06; 445.212 seconds u

    Code:
                            Additional Message Information                         
                                                                                    
     Message ID . . . . . . :   CPA0702                                             
     Date sent  . . . . . . :   13/01/14      Time sent  . . . . . . :   02:15:05   
                                                                                    
     Message . . . . :   CPF2817 received by procedure SDCJD. (C D I R)             
                                                                                    
     Cause . . . . . :   ILE Control language (CL) procedure SDCJD in module SDCJD  
       in program SDCJD in library BAJUSRLIB detected an error at statement number  
       0000002600.  Message text for CPF2817 is: Copy command ended because of      
       error.  Use F10 (if available) or the Display Job Log (DSPJOBLOG) command    
       to see the messages in the job log for a more complete description of what   
       caused the error.  If you still are unable to solve the problem, please      
       contact your technical support person.                                       
     Recovery  . . . :   This inquiry message can be avoided by changing the        
       procedure. Monitor for the error (MONMSG command) and perform error          
       recovery within the procedure.  To continue, choose a reply value.           
     Possible choices for replying to message . . . . . . . . . . . . . . . :       
                                                                            More... 
     Press Enter to continue.                                                       
                                                                                    
     F1=Help   F3=Exit   F6=Print   F9=Display message details   F12=Cancel         
     F21=Select assistance level                                                    
        
                             Additional Message Information                         
                                                                                    
     Message ID . . . . . . :   CPA0702                                             
     Date sent  . . . . . . :   13/01/14      Time sent  . . . . . . :   02:15:05   
                                                                                    
     Message . . . . :   CEE9901 received by procedure SDCJREC. (C D I R)           
                                                                                    
     Cause . . . . . :   ILE Control language (CL) procedure SDCJREC in module      
       SDCJREC in program SDCJREC in library BAJUSRLIB detected an error at         
       statement number 0000002000.  Message text for CEE9901 is: Application       
       error.  CPF2817 unmonitored by SDCJD at statement 0000002600, instruction    
       X'0000'.  Use F10 (if available) or the Display Job Log (DSPJOBLOG) command  
       to see the messages in the job log for a more complete description of what   
       caused the error.  If you still are unable to solve the problem, please      
       contact your technical support person.                                       
     Recovery  . . . :   This inquiry message can be avoided by changing the        
       procedure. Monitor for the error (MONMSG command) and perform error          
       recovery within the procedure.  To continue, choose a reply value.           
                                                                            More... 
     Press Enter to continue.                                                       
                                                                                    
     F1=Help   F3=Exit   F6=Print   F9=Display message details   F12=Cancel         
     F21=Select assistance level                                                    
                                                                                    
                             Additional Message Information                         
                                                                                    
     Message ID . . . . . . :   CPA0702                                             
     Date sent  . . . . . . :   13/01/14      Time sent  . . . . . . :   02:15:05   
                                                                                    
     Message . . . . :   CEE9901 received by procedure C50SAVACT. (C D I R)         
                                                                                    
     Cause . . . . . :   ILE Control language (CL) procedure C50SAVACT in module    
       C50SAVACT in program C50SAVACT in library KLIBTRE detected an error at       
       statement number 0000017500.  Message text for CEE9901 is: Application       
       error.  CEE9901 unmonitored by SDCJREC at statement 0000002000, instruction  
       X'0000'.  Use F10 (if available) or the Display Job Log (DSPJOBLOG) command  
       to see the messages in the job log for a more complete description of what   
       caused the error.  If you still are unable to solve the problem, please      
       contact your technical support person.                                       
     Recovery  . . . :   This inquiry message can be avoided by changing the        
       procedure. Monitor for the error (MONMSG command) and perform error          
       recovery within the procedure.  To continue, choose a reply value.           
                                                                            More... 
     Press Enter to continue.                                                       
                                                                                    
     F1=Help   F3=Exit   F6=Print   F9=Display message details   F12=Cancel         
     F21=Select assistance level       
    
                             Additional Message Information                         
                                                                                    
     Message ID . . . . . . :   CPF1164                                             
     Date sent  . . . . . . :   13/01/14      Time sent  . . . . . . :   02:15:06   
                                                                                    
     Message . . . . :   Job 782705/MYOUNUS/C50SAVACT ended on 13/01/14 at          
       02:15:06; 445.212 seconds used; end code 20                                  
                                                                                    
                              X.                                                    
                                                                                    
     Cause . . . . . :   Job 782705/MYOUNUS/C50SAVACT completed on 13/01/14 at      
       02:15:06 after it used 445.212 seconds processing unit time.  The job had    
       ending code 20. The job ended after 1 routing steps with a secondary ending  
       code of 0.  The job ending codes and their meanings are as follows:          
          0 - The job completed normally.                                           
         10 - The job completed normally during controlled ending or controlled     
       subsystem ending.                                                            
         20 - The job exceeded end severity (ENDSEV job attribute).                 
                                                                            More... 
     Press Enter to continue.                                                       
                                                                                    
     F1=Help   F3=Exit   F6=Print   F9=Display message details   F12=Cancel         
     F21=Select assistance level                                                    
                                                                                                                                 
                                 
    Message ID . . . . . . . . . :   CPA0702          
    Message file . . . . . . . . :   QCPFMSG          
      Library  . . . . . . . . . :     QSYS           
                                                      
    Severity . . . . . . . . . . :   99               
    
    Job description:   QBATCH         Library:   KLIBTRE                   
                                                                           
    User profile . . . . . . . . . . . . . . . . . . :   *RQD              
    CL syntax check  . . . . . . . . . . . . . . . . :   *NOCHK            
    Hold on job queue  . . . . . . . . . . . . . . . :   *NO               
    End severity . . . . . . . . . . . . . . . . . . :   30

  • #2
    Re: Submitted job auto cancelling

    Either someone is answering those messages or you have automatic message replies on those message ID's. You need to monitor for those errors in your cl.

    Comment


    • #3
      Re: Submitted job auto cancelling

      No-one is answering them and they are not set to auto reply. To test I wrote this program TEST

      PGM
      ADDLIBLE ASDASD
      ENDPGM

      If I call it I get CPF2110 received by at 200. (C D I R) displayed on the screen. This is OK.

      If I submit it though the message is automatically cancelled:
      Code:
      40   13/01/14  16:08:15.503566  QLICUSRL     QSYS        0196     TEST        ADAM   
        Message . . . . :   Library ASDASD not found.                                      
      99   13/01/14  16:08:15.517632  QCLXERR      QSYS        00DA     QCLXERR     QSYS   
        Message . . . . :   CPF2110 received by TEST at 200. (C D I R)                     
                    Job Log                             DEQUT01  13/01/14 16:08:15         
      TEST            User  . . . . . . :   ADAM         Number . . . . . . . . . . . :   6
      QDFTJOBD        Library . . . . . :   QGPL                                           
      SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY
           13/01/14  16:08:15.517924  QMHSNINQ     QSYS        1018     QCLXERR     QSYS   
        Message . . . . :   C                                                              
      40   13/01/14  16:08:15.517450  QMHUNMSG                 *N       QCMD        QSYS   
        Message . . . . :   Function check. CPF2110 unmonitored by TEST at statement       
          200, instruction X'000C'.                                                        
      50   13/01/14  16:08:15.518137  QCMD         QSYS        066D     *EXT               
        Message . . . . :   Job ended. Cancel message received at command processor.       
      00   13/01/14  16:08:15.523574  QWTMCEOJ     QSYS        0148     *EXT               
        Message . . . . :   Job 667377/ADAM/TEST ended on 13/01/14 at 16:08:15; .031       
          seconds used; end code 20 .
      If there no way to get C D I R in batch? My original program calls about 70 others. Would I have to put MONMSG CPF0000 after each call, send the user a message C D I R and then GOTO the line calling the program? For every command in the program i may want to retry? Surely there must be a better way. I hope so anyway.

      Like this I mean - it is more long winded than

      CALL PGM1
      CALL PGM2
      ADDLIBLE ASDASD

      Code:
      A1:  CALL PGM1
      MONMSG CPF0000 EXEC(GOTO ERR1)
      GOTO A2
      ERR1: SNDUSRMSG MSG(&MSG) VALUES('C' 'D' 'I' 'R') +
                TOMSGQ(&QUEUE) MSGRPY(&RPY)
                IF COND(&RPY = 'R') THEN(GOTO A1)
      
      A2:  CALL PGM2
      MONMSG CPF0000 EXEC(GOTO ERR2)
      GOTO A3
      ERR2: SNDUSRMSG MSG(&MSG) VALUES('C' 'D' 'I' 'R') +
                TOMSGQ(&QUEUE) MSGRPY(&RPY)
                IF COND(&RPY = 'R') THEN(GOTO A2)
      
      A3:  ADDLIBLE ASDASD
      MONMSG CPF0000 EXEC(GOTO ERR3)
      GOTO A4
      ERR3: SNDUSRMSG MSG(&MSG) VALUES('C' 'D' 'I' 'R') +
                TOMSGQ(&QUEUE) MSGRPY(&RPY)
                IF COND(&RPY = 'R') THEN(GOTO A3)
      
      etc
      Last edited by adam fisher; January 13, 2014, 07:40 AM. Reason: clarify

      Comment


      • #4
        Re: Submitted job auto cancelling

        The reason was QSYSOPR set to *DFT. With *HOLD job goes to MSGW with C D I R.

        Comment


        • #5
          Re: Submitted job auto cancelling

          Originally posted by adam fisher View Post
          Is there no way to get C D I R in batch?
          If you do not monitor for messages, the system will send a message to QSYSOPR and wait for a reply. You do not have to enable this feature; it is the default behavior.

          Look in your programs for message-monitoring logic.

          Comment


          • #6
            Re: Submitted job auto cancelling

            So what I need is a programmatical way to see if QSYSOPR is set to *DFT. Then I can send a message to operator to change it as I can't monitor for every possible scenario (easily).

            Having it set to *DFT is dangerous but any other value seems to be fine so I don't want put CHGMSGQ QSYSOPR *HOLD as they may want *BREAK.

            Is there some way to do this - it doesn't seems to be on DSPOBJD. Where could I find its setting?

            Comment


            • #7
              Re: Submitted job auto cancelling

              Originally posted by adam fisher View Post
              So what I need is a programmatical way to see if QSYSOPR is set to *DFT.
              No, you need to remove the message-monitoring logic from your program.

              The "green screen of death", as I call it, is a last resort. The system only asks the C-D-I-R question if you haven't told it how to handle unexpected situations.

              Comment


              • #8
                Re: Submitted job auto cancelling

                Yes but my program calls about 70 other programs at the moment. I don't want to put any message logic around every CALL in case they crash for whatever unknown reason. Although I will if I have to. I want the job to go to MSGW state and certainly not just stop half way through. Then if the called program failed due to an easily fixable issue (record lock, missing object) the operator can fix it, retry and carry on. That is why I want C D I R.

                If you do not monitor for messages, the system will send a message to QSYSOPR and wait for a reply.
                This works as you said (and is what I want) if QYSYSOPR is not set to *DFT so I want to check what it is set to before executing my program.

                Comment


                • #9
                  Re: Submitted job auto cancelling

                  Adding code to prompt QSYSOPR for a reply reminds me of the guy I heard of who never fixed a bug in his program. He just added more code to reverse the damage.

                  Forgive my ignorance. What do you mean by "QSYSOPR is not set to *DFT"?

                  Maybe somebody else can jump in here and help you. I am unable to grasp the problem.

                  Good luck, Adam!

                  Comment


                  • #10
                    Re: Submitted job auto cancelling

                    Never mind. I see now. You're talking about the DLVRY parameter on the QSYSOPR message queue.

                    Have you looked for an API to retrieve the message queue setting?

                    Comment


                    • #11
                      Re: Submitted job auto cancelling

                      Originally posted by TedHolt View Post
                      Never mind. I see now. You're talking about the DLVRY parameter on the QSYSOPR message queue.

                      Have you looked for an API to retrieve the message queue setting?
                      Yes - that is what I meant - sorry not to be clear. I don't want QSYSOPR to take the default reply (which seems to be Cancel for CEE9901 Application Error) in case my program (or any of the ones I call) encounter an error they haven't monitored for.

                      I think can use Retrieve Nonprogram Message Queue Attributes (QMHRMQAT) API to check that no-one has changed delivery method (DLVRY parameter on CHGMSGQ) to *DFT.

                      Thanks for your help

                      Comment


                      • #12
                        Re: Submitted job auto cancelling

                        Originally posted by adam fisher View Post
                        I think can use Retrieve Nonprogram Message Queue Attributes (QMHRMQAT) API to check that no-one has changed delivery method (DLVRY parameter on CHGMSGQ) to *DFT.
                        Yes, you can. Have you decided what you'll do if you find it set to *DFT? You probably can't simply send a message to QSYSOPR to ask that the delivery be changed. If it's in *DFT, it's unlikely to be seen by anyone.
                        Tom

                        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                        Comment


                        • #13
                          Re: Submitted job auto cancelling

                          Originally posted by tomliotta View Post
                          Have you decided what you'll do if you find it set to *DFT?
                          In the (interactive) job that submits it I added this code (found on this forum somewhere)

                          DCL VAR(&RCVVAR) TYPE(*CHAR) LEN(150)
                          DCL VAR(&QMQ) TYPE(*CHAR) LEN(20) VALUE('QSYSOPR *LIBL')
                          DCL VAR(&ERRCOD) TYPE(*CHAR) VALUE(X'0000000000000000')
                          DCL VAR(&DELIVERY) TYPE(*CHAR) LEN(7)

                          CALL PGM(QMHRMQAT) PARM(&RCVVAR X'00000096' +
                          'RMQA0100' &QMQ &ERRCOD)
                          CHGVAR VAR(&DELIVERY) VALUE(%SST(&RCVVAR 53 7))

                          If &DELIVERY = '*DFT' then SNDBRKMSG

                          Works fine

                          Comment

                          Working...
                          X