ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

is 'CL:' not allowed in sql procedure/function?

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

  • is 'CL:' not allowed in sql procedure/function?

    OS 7.1 with all current PTFs

    I've created the sql procedure below, but I receive an error (sql0104: 'Token CL was not valid. Valid tokens: ( END SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER.') when I try to execute it.

    Is keyword 'CL:' not allowed in this setting, or am I doing something wrong?

    Code:
    create or replace procedure submitJob
    (
      in pCommand            varchar(1024),
      in pJobName            varchar(10),
      in pJobDescription     varchar(10),
      in pJobQ               varchar(10),
      in pJobUser            varchar(10),
      in pJobDelaySeconds    int
    )
    
    specific syJobSbm
    
    result sets 0
    language sql
    modifies sql data
    not deterministic
    
    set option Commit=*NONE      ,DatFmt=*ISO   ,DynUsrPrf=*OWNER ,UsrPrf=*OWNER   ,DlyPrp=*YES
              ,CloSqlCsr=*ENDMOD ,SQLpath=*LIBL ,DftRdbCol=*NONE  ,DbgView=*SOURCE
    ...
    
        set lCursortext = 'cl: sbmJob cmd(?) job(?) jobd(?) jobq(?) user(?) scdTime(?)';
        prepare lCursorStatement from lCursorText;
    
        execute lCursorStatement using pCommand, pJobName, pJobDescription, pJobQ, pJobUser, lScheduleTime;
    
    ...

  • #2
    You need to execute CL commands by calling the QCMDEXC stored procedure.

    Code:
    Call QCMDEXC('sbmJob cmd(' concat PCommand concat ') job(' concat pJobName concat ') jobd(' concat PJobDecsription concat
                             ') jobq(' concat PJobQ concat ') user(' concat PJobUser concat ') scdTime(' concat lScheduleTime concat ')');
    Birgitta

    Comment


    • #3
      Thanks for the reply Birgitta. 0-)

      I had actually already coded it using qcmdexc() since I couldn't get my first attempt to work.

      I was just left wondering if it was something that I was doing wrong, or whether it is not allowed by the compiler.

      Walt

      Comment

      Working...
      X