ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Internal procedure call compile error

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

  • Internal procedure call compile error

    I have lots of these:

    @msg = 'MSG0101';
    exsr Sr_SndMsg;

    Where the literal may be different.

    So I changed the SndMsg routine to an internal procedure and replaced the code with:

    SndMsg ('MSG0101');

    but i get the following compile error:

    *RNF7542 30 10 Parameter cannot be passed by reference when it can be changed during the call.


    Please don't say this isn't possible?
    www.midlifegamers.co.uk

  • #2
    Re: Internal procedure call compile error

    Here's the procedure I'm calling

    Code:
    pPr_SndMsg        B                                                                  
    dPr_SndMsg        PI                                                                 
    d  @msgID                        7                                                   
     /free                                                                               
                                                                                         
      if @MsgFileName = *blanks;                                                         
        @MsgFileName = 'USRMSG';                                                         
      endif;                                                                             
                                                                                         
      // Send message to program message queue                                           
      if @MsgID <> *blanks ;                                                             
        callp pgm_sndmsgq (@PgmName:@PgmRelLVl:@MsgFileName:@MsgID:@MsgData:             
                           @MsgType);                                                    
      endif;                                                                             
                                                                                         
      // Reset after use.                                                                
      @MsgId = *blanks;                                                                  
      @MsgData = *blanks;                                                                
      @MsgFileName = *blanks;           
    
      /End-Free                   
                                  
     pPr_SndMsg        E
    Last edited by Huddy; June 10, 2013, 08:38 AM.
    www.midlifegamers.co.uk

    Comment


    • #3
      Re: Internal procedure call compile error

      If you want to pass your parameter by (constant) reference, i.e. passing a string, you need to add the keyword CONST to the parameter definition. Instead of CONST you may also use the keyword VALUE.

      BTW you pass @MSGID2, but it is not used within your procedure!

      Birgitta

      Comment


      • #4
        Re: Internal procedure call compile error

        yep, sorry was work in progress.

        Changed to CONST and all works..

        thanks
        www.midlifegamers.co.uk

        Comment

        Working...
        X