zOs/SQL/STPRWSH

set current sqlid = 'S100447' ;
drop   procedure qz91WshTst1.proc1;
commit;
terminator} ;
create procedure qz91WshTst1.proc1
       (in a1 varchar(20), inOut cnt int, out res varchar(20))
        version v1 not deterministic reads sql data
        dynamic result sets 3
    begin
    declare prC1 cursor with return for
        select 'cur1' cur, name, colType, length, left(a1, 5) a1
        from sysibm.sysColumns
        where tbCreator = 'SYSIBM' and tbName = 'SYSTABLES'
        order by colNo
        fetch first 1 rows only;
    declare prC2 cursor with return for
        select 'cur2' cur, name, colType, left(a1, 5) a2
        from sysibm.sysColumns
        where tbCreator = 'SYSIBM' and tbName = 'SYSTABLES'
        order by colNo
        fetch first 3 rows only;
    declare prC3 cursor with return for
        select 'cur3' cur, name, left(a1, 5) a3
        from sysibm.sysColumns
        where tbCreator = 'SYSIBM' and tbName = 'SYSTABLES'
        order by colNo
        fetch first 3 rows only;
    if cnt >= 3 or cnt = -3 then
        open prC3;
        end if;
    if cnt >= 2 or cnt = -2 then
        open prC2;
        end if;
    if cnt >= 1 or cnt = -1 then
        open prC1;
        end if;
    set res = strip(left(a1, 10)) || ' ' || cnt;
    set cnt = cnt + 1;
/*  declare exit handler for not found
        begin
        set aPrm = 'not found ' || char(sqlCode);
        end;
    select count(*), min(version) into cnt, vers
        from sysibm.sysRoutines r
        where r.name = selP1.name;
    select char(parm_count)  into aPrm
        from sysibm.sysRoutines r
        where r.name = selP1.name
        and   active = 'Y';
*/  end
}
terminator; }
call qz91WshTst1.proc1('arg1istLängeroder',   123
       , und                             bis);
rollback;
call qz91WshTst1.proc1('callEinsP1',  :c, :v);
call gdb9998.selP1(VERSP1, :c, :v, :p);
call gdb9998.selP1(xxxYY,  :c, :v, :p);
rollback;