ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Error when RPGLE calling a CL program (possibly)

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

  • Error when RPGLE calling a CL program (possibly)

    Hello, I am a new RPGLE developer and I came across this error that I cannot figure out. Not much information about it online either. So...

    I tried to include only the important bits of my code. I may have left out or put in too much info, so if anything else is needed please let me know.
    First the error message:

    Code:
    Message ID . . . . . . :   RNQ0202       Severity . . . . . . . :   99      
    Message type . . . . . :   Inquiry                                          
    Date sent  . . . . . . :   07/11/17      Time sent  . . . . . . :   15:40:41
    
    Message . . . . :   The call to ISEOUTFILE ended in error (C G D F).        
    Cause . . . . . :   RPG procedure EDIRPT01 in program ISE/EDIRPT01 at       
      statement 007800 called program or procedure ISEOUTFILE, which ended in   
      error. If the name is *N, the call was a bound call by procedure pointer.
    Line 78 is where I call the ISEOUTFile procedure: ISEOUTFile(RankArray); I believe the error is in the procedure, but it doesn't say which line.
    From debugging, I saw that the 2 parameters for EDIMONITCL is SavDocLst(a character of len 100), and a Wrkrank(packed 2:0) like it's suppose to be.

    RPGLE
    Code:
    DCL-PROC ISEOUTfile;               
    
    DCL-PI ISEOUTfile;                 
        RankArray packed (2:0) Dim(10);
    END-PI ;                           
    
    DCL-S SavDocLst Char(100);         
    DCL-S x packed(2:0);
    
    For x = 1 to %Elem(RankArray);     
    WrkRank = RankArray(x);            
    
    // does something in sql (all errors checked out on this part)
    
    Callp CrtSubMail(WrkRank:SavDocLst);
    
    Callp EDIMONITCL(SavDocLst:WrkRank);          //ERROR HERE
    /////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    DCL-PROC CrtSubMail;        
    
    DCL-PI CrtSubMail Char(100);
        WrkRank Packed(2:0);    
        SavDoclst Char(100);    
    END-PI ;                    
    DCL-S WkFirst Char(1);      
    DCL-S SAVDOC Char(10) ;     
    
    Dow sqlcode = 0;                                      
        If WkFirst = 'Y';                                 
            SavDoclst = %trim(SAVDOC);                    
            WkFirst = 'N';                                
        Else;                                             
        SavDoclst = %trim(SavDoclst) + '' + %trim(SAVDOC);
    Endif;                                                  
    enddo;                                                
    Return SavDoclst ;                                    
    END-PROC CrtSubMail;



    EDIMONITCL (CL Program)
    Code:
    PGM   PARM(&SUBJECT &RANK)
    
    DCL   VAR(&SUBJECT) TYPE(*CHAR) LEN(100)
    DCL   VAR(&RANK) TYPE(*DEC) LEN(2 0)
    
    // does stuff here


  • #2
    Assuming you're using the green screen version of debug (STRDBG) you can step through using F10 - but when you get to the call to EDIMONITCL press F22 and it will step into the source - assuming you compiled it correctly (though I recommend changing it from CLP to CLLE and specifying DBGVIEW(*ALL) when compiling... I make *ALL the default value on the CRTBNDCL command - but if you wish to keep it as CLP make sure you specify OPTION(*LSTDBG). This way you can step through your program right up to when it errors out.

    Comment


    • #3
      Is there another message in the joblog before the RNQ0202? Normally, a call to a CL program or procedure wouldn't fail unless the CL had some kind of error, which should show up in the joblog.

      Comment


      • #4
        the relevant libraries were in wrong order, so I fixed that.

        There is an error in the CL file. I went into the CL file and debugged.

        got a error on:
        CHGVAR (&SUBJECT1) VALUE('EDI MONITORING STATUS:' *TCAT &SUBJECT)
        Code:
        Message ID . . . . . . :   MCH3601       Severity . . . . . . . :   40      
        Message type . . . . . :   Diagnostic                                        
        Date sent  . . . . . . :   07/12/17      Time sent  . . . . . . :   09:54:22
        
        Message . . . . :   Pointer not set for location referenced.                
        Cause . . . . . :   A pointer was used, either directly or as a basing      
          pointer, that has not been set to an address.
        the &SUBJECT1 is a char 100 and the &SUBJECT is also a char 100, that is being received from the rpgle program. it's suppose to receive something like
        '856830850824 ' (100 characters).


        From the RPG side, I got this new error
        Code:
         Message ID . . . . . . :   CPA0702       Severity . . . . . . . :   99      
         Message type . . . . . :   Inquiry                                          
         Date sent  . . . . . . :   07/12/17      Time sent  . . . . . . :   09:40:44
        
         Message . . . . :   CPF9897 received by procedure EDIMONITCL. (C D I R)    
         Cause . . . . . :   ILE Control language (CL) procedure EDIMONITCL in module
           EDIMONITCL in program EDIMONITCL in library ISE detected an error at      
           statement number 0000003400.  Message text for CPF9897 is: Send E-mail    
           Failed.  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.
        line 34 of the CL file is the same line as above. CHGVAR (&SUBJECT1) VALUE('EDI MONITORING STATUS:' *TCAT &SUBJECT)



        EDIT: upon looking these errors up, I think may have something to do with empty parameter values (which is not the case here) or something to do with the length of the parameter? any thoughts? The parameter I am passing is a char 100, and also on the receiving end, &SUBJECT1 is a char 100...

        Comment


        • #5
          The issue with the chgvar is that you're trying to put 10 gallons of water in a 5 gallon bucket. If &SUBJECT is 100 characters you're trying to put in 124 characters (give or take) into a 100 character field (&subject1). You need to either declare &subject1 to be larger (125) or use %sst function ... ie CHGVAR (&SUBJECT1) VALUE('EDI MONITORING STATUS:' *TCAT %SST(&SUBJECT 1 75))

          Pointer not set indicates that you're referring to a parameter that wasn't passed - ie calling program passed two parms but the program being called expects 3 and you're trying to refer to the third. Since the calling program didn't specify a value the pointer to a value doesn't exist.

          Comment


          • #6
            Originally posted by Rocky View Post
            The issue with the chgvar is that you're trying to put 10 gallons of water in a 5 gallon bucket. If &SUBJECT is 100 characters you're trying to put in 124 characters (give or take) into a 100 character field (&subject1). You need to either declare &subject1 to be larger (125) or use %sst function ... ie CHGVAR (&SUBJECT1) VALUE('EDI MONITORING STATUS:' *TCAT %SST(&SUBJECT 1 75))
            This won't cause an error though. CL will simply put what will fit into &SUBJECT, the rest will be discarded so the %SST is unnecessary. The OP would need to decide if that's acceptable.

            As Rocky has mentioned, the MCH3601 error means your called program is trying to reference a parameter that hasn't been passed.

            Comment


            • #7
              Originally posted by john.sev99 View Post

              This won't cause an error though. CL will simply put what will fit into &SUBJECT, the rest will be discarded so the %SST is unnecessary. The OP would need to decide if that's acceptable.

              True - it's the only error I see and I lose track sometimes of what blows up and what is simply ignored.... thanks for the correction.

              Comment


              • #8
                In your RPG, you are using CALLP to call EDIMONITCL, but I do not see a DCL-PR definition for it in the code you shared. Is there one? if so, please share it.

                Comment


                • #9
                  Is this the complete DOW code block?
                  Code:
                  Dow sqlcode = 0;
                     If WkFirst = 'Y';
                         SavDoclst = %trim(SAVDOC);
                         WkFirst = 'N';
                     Else;
                     SavDoclst = %trim(SavDoclst) + '' + %trim(SAVDOC);
                  Endif;
                  enddo;
                  If so, do you really want it to be a DOW?

                  It looks like you want to take a few SAVDOC values and put them together in a blank-separated list of names. Is this "list" intended to be used as a list parameter value in some command in the CL?
                  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


                  • #10
                    Originally posted by Vectorspace View Post
                    In your RPG, you are using CALLP to call EDIMONITCL, but I do not see a DCL-PR definition for it in the code you shared. Is there one? if so, please share it.
                    Yes,
                    Code:
                    DCL-PR EDIMONITCL Extpgm('EDIMONITCL');
                        PList char(100);                  
                        PRank packed(2:0);                
                    END-PR;

                    Comment


                    • #11
                      Originally posted by tomliotta View Post
                      Is this the complete DOW code block?
                      Code:
                      Dow sqlcode = 0;
                      If WkFirst = 'Y';
                      SavDoclst = %trim(SAVDOC);
                      WkFirst = 'N';
                      Else;
                      SavDoclst = %trim(SavDoclst) + '' + %trim(SAVDOC);
                      Endif;
                      enddo;
                      If so, do you really want it to be a DOW?

                      It looks like you want to take a few SAVDOC values and put them together in a blank-separated list of names. Is this "list" intended to be used as a list parameter value in some command in the CL?
                      this SavDoclst is suppose to be a subject for a email. The values are coming out as they are suppose to, but it's not being separated by a space. ex: should be '810 839 813' but comes out like '810839813 and then remaining spaces here' because savdoclist is a char(100)...

                      Comment


                      • #12
                        Originally posted by skwon9642 View Post
                        this SavDoclst is suppose to be a subject for a email. The values are coming out as they are suppose to, but it's not being separated by a space. ex: should be '810 839 813' but comes out like '810839813 and then remaining spaces here' because savdoclist is a char(100)...
                        Given only the code shown and assuming that there is a blank between the single-quotes, SavDoclst should have embedded single blanks between each SAVDOC value for its final result. If there are no embedded blanks when it's later used, something else should be happening that isn't shown.
                        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
                          As typed into the post, this code line:
                          Code:
                           
                           SavDoclst = %trim(SavDoclst) + '' + %trim(SAVDOC);
                          Does not have a space between the two apostrophes, making it zero length so it might as well not be there.. Line three is what it should be
                          Code:
                           
                           SavDoclst = %trim(SavDoclst) + '' + %trim(SAVDOC);    // Original line, no space between the two '   
                           SavDoclst = %trim(SavDoclst) + ' ' + %trim(SAVDOC);    // This is what it would need to be to have a space

                          Your error message says EDIMONITCL had an error on line 34:
                          Code:
                           
                           ILE Control language (CL) procedure EDIMONITCL in module 
                           EDIMONITCL in program EDIMONITCL in library ISE detected an error
                           at statement number 0000003400
                          What is line 34?
                          It also says that it is the version on library ISE that is having the error. Is that the correct library?

                          Comment


                          • #14
                            Originally posted by skwon9642 View Post

                            this SavDoclst is suppose to be a subject for a email. The values are coming out as they are suppose to, but it's not being separated by a space. ex: should be '810 839 813' but comes out like '810839813 and then remaining spaces here' because savdoclist is a char(100)...
                            Web interface could be screwing it up - but from here it appears tahat the '' are together with no space between them.

                            Comment

                            Working...
                            X