zOs/TX/PER03SWX

call sqlConnect dbaf
tkkey = 5003240
tkBis = 5007840
s =    "",
       "from  GDB0351.vFI027A1 where tkKey between ? and ?" ,
       "and mut_timestamp = '2008-11-09-07.14.51.229389'" ,
       ""
s ="select count(*), min(kursDatum), max(KursDatum)" ,
       "from  GDB0351.vFI027A1 where tkKey =  ?"
s ="select count(*), min(verfall), max(verfall)" ,
       "from  GDB0351.vFI027A1 where tkKey = ?"
p1 = pos('?', s)
p2 = pos('?', s, p1+1)
if 1 then do
    call sqlPreAllCl 1, left(s,p1-1) tkKey substr(s, p1+1) ,
                     , st, ':cnt,:min,:max'
    end
else if 1 then do
    call sqlPrepare 1, s
    call sqlOpAllCl 1, st, ':cnt,:min,:max', tkKey
    end
else if 0 then do
    call sqlPreAllCl 1, left(s,p1-1) tkkey substr(s, p1+1, p2-p1-1),
                                 tkBis substr(s, p2+1),
                     , st, ':cnt,:min,:max'
    end
else do
    call sqlPrepare 1, s
    call sqlOpAllCl 1, st, ':cnt,:min,:max', tkKey, tkBis
    end
$$- m.st.0 'cnt' cnt':' min '-' max
call sqlDisconnect
$#out                                              20100803 14:34:48
$#out                                              20100803 14:35:44
$#out                                              20100803 14:35:15
1 cnt 166: 21.12.2009 - 26.04.2011
$#out                                              20100803 14:32:36
1 cnt 166: 21.12.2009 - 26.04.2011
$#out                                              20100803 14:30:23
1 cnt 1: 21.12.2009 - 21.12.2009
$#out                                              20100803 14:30:00
1 cnt 1: 30.03.2006 - 30.03.2006
$#out                                              20100803 13:58:51
1 cnt 1: 30.03.2006 - 30.03.2006
$#out                                              20100803 13:57:50
1 cnt 1: 30.03.2006 - 30.03.2006
$#out                                              20100803 13:56:14
1 cnt 5: 27.03.2006 - 31.03.2006
$#out                                              20100803 13:41:15
$#out                                              20100803 13:55:12
$#out                                              20100803 13:44:39
1 cnt 276396: 23.03.2006 - 24.05.2010
$#out                                              20100803 13:40:48
1 cnt 276396: 23.03.2006 - 24.05.2010
$#out                                              20100803 13:38:54
1 cnt 166: 27.03.2006 - 24.05.2010
$#out                                              20100803 13:37:43
1 cnt 166: 27.03.2006 - 24.05.2010
$#out                                              20100802 17:29:05
$#out                                              20100803 12:14:18
$#out                                              20100803 12:09:31