ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Call a stored procedure from a CLLE program

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

  • Call a stored procedure from a CLLE program

    Hi folks!

    I have an SQL stored procedure that I try to call from a CLLE program. I'm not really an iNewbie but I haven't worked with stored procedures before. I did several hours of googlin' but could not find anything that would help me solve my issue. So here it is, I certainly appreciate all the help I can get.

    My SQL Stored Procedure:
    create or replace procedure STOREDPRC1 (IN USER_ID char(10))
    --Delete the SPLF for a given user from table MyTable
    language SQL modifies SQL data
    begin
    delete from MYTABLE
    where USER = USER_ID
    with NC
    ;
    end


    Note:
    Table MYTABLE does exist and had rows the would be affected by the SQL.

    My CLLE calls:
    DCL VAR(&USR) TYPE(*CHAR) LEN(10)
    CALLPRC PRC(
    STOREDPRC1) PARM((&USR))
    CALL PGM(
    STOREDPRC1) PARM(&USR)

    On the CALL, I always get error:
    Pointer not set for location referenced.

    During CLLE debug:
    • The CALLPRC line cannot be debugged
    • The CALL looks good, the parameter is correct
    My questions:
    1. What call should I actually be using, CALL or CALLPRC?
    2. How should I format the call to my stored procedure in CLLE?
    3. Why would I get the 'Pointer not set...' error?
    4. Why does the CALLPRC not allow debugging it in CLLE?
    Looking forward to your input.


    Happy coding!
    -----------------
    Paul
    Sweden

  • #2
    A (SQL) Stored Procedure must be called with the SQL CALL Command. So you need execute the RUNSQL Statement, where you include your SQL CALL Command.

    Comment


    • #3
      Hi B,

      That sounds easy. I'll be traveling today and tomorrow but Friday first thing I'll be trying that! Thanks!

      Happy coding!
      -----------------
      Paul
      Sweden

      Comment


      • #4
        Hi folks!

        Moved my follow up question to the SQL part of Code400. CU there?

        Comment

        Working...
        X