zOs/SQL/EXSCROLL

$#@
call errReset 'h', "say 'err ox='ox':' arg(1)"
call sqlConnect dp4g
src = "select name, row_number() over() rn" ,
     "from sysibm.sysTables" ,
     "where creator = 'SYSIBM'  and name like 'DSN%'"
cx = 7
attr = 'with hold'
attr = 'insensitive scroll with hold'
cCom = 1e9
res = sqlExec('prepare s'cx 'attributes :attr from :src')
if 1 then do /* open close cursor, do we get sqlCode -497 ?
                      with scroll at 11768
                      without scroll not
                      hold is irrelevant */
    do ox=1
       if ox // 1000 = 1 then
           say ox time('e')
        res = sqlExec('declare c'cx 'cursor for s'cx)
        res = sqlExec('open  c'cx)
        res = sqlExec('close  c'cx)
        if ox // cCom = 0 then
            say ox 'commit' sqlCOmmit()
        end
    end
else if 1 then do   /* scroll forward/backward thru cursor */
    res = sqlExec('prepare s'cx 'attributes :attr from :src')
    res = sqlExec('declare c'cx 'cursor for s'cx)
    res = sqlExec('open  c'cx)
    do ox=1 until res <> 0
        if ox // 4 = 0 then
            ori = 'prior'
        else
            ori = ''
        res = sqlExec('fetch' ori 'c'cx 'into :nm, :rn')
        say right(ox, 3) left(ori, 10) res':' rn nm
        if ox // cCom = 0 then
            say ox 'commit' sqlCOmmit()
        end
    res = sqlExec('close  c'cx)
    end
$#out                                              20140313 17:15:53