zOs/TX/PER07INS

$>.jclSub()
$=fx=5
$=tx=6
$@do jx=$fx to $tx $@=[
//A540769$jx JOB (CP00,KE50),'DB2 REO',
//         MSGCLASS=T,TIME=1440,
//         NOTIFY=&SYSUID,REGION=0M
//*MAIN CLASS=S1$jx,SYSTEM=S1$jx
//S1       EXEC PGM=IKJEFT01,DYNAMNBR=200,TIME=99,
//            PARM='%WSH'
//SYSPROC   DD DSN=A540769.WK.REXX,DISP=SHR
//SYSPRINT  DD SYSOUT=*
//SYSUDUMP  DD SYSOUT=*
//SYSTSPRT  DD SYSOUT=*
//OUT       DD SYSOUT=*
//SYSTSIN   DD DUMMY
//WSH       DD *    DISP=SHR,DSN=A540769.WK.REXX(RCG)
call sqlConnect dbaf
$@/ww/
if $jx = $fx then $@=/w1/
call sqlPreAllCl 1, 'select current packageset from sysibm.sysDummy1',
              ,q,':pkg'
say 'pkg was:' pkg
call sqlExec "set current packageSet = 'DSNREXRR'"
call sqlPreAllCl 1, 'select current packageset from sysibm.sysDummy1',
              ,q,':pkg'
say 'pkg set to' pkg
$'$@do' lx=1 to 300   $'$@'[
    call sqlPreAllCl 1, 'select max(ix) from A540769.tPer07x$fx',
              , st, ':mx'
    if lx // 100 = 1 then
        say lx 'max' mx
    $'$@do' kx=$fx to $tx $'$@['
    call sqlExec "insert into A540769.tPer07X"$'$kx' "(cur, ix)" ,
        "values(current timestamp," (mx+1)")"
        $'$]'
    call sqlCommit
$'$]'
$/w1/ else  $@=/w2/
$'$@do' lx=1 to  700 $'$@['
    if 0 then
        call sqlExec "insert into A540769.tPer06x$tx (cur)" ,
            "values ( current timestamp )"
    if 0 then do
        qu = ''
        call sqlPreAllCl 1, 'select current timestamp,',
              '(select max(ix) from A540769.tPer07x$fx),',
              '(select max(ix) from A540769.tPer07x$tx)',
              'from sysibm.sysDummy1 with rr',
            , st , ':qt, :q$fx, :q$tx'
        end
    else do
        call sqlPreAllCl 1, 'select ix, current timestamp',
              'from A540769.tPer07x$fx t$tx where ix =' ,
                  '(select max(ix) from A540769.tPer07x$fx)',
                  'with rr' ,
            , st , ':q$fx, :qt'
        call sqlPreAllCl 1, 'select ix, current timestamp',
              'from A540769.tPer07x$tx t$tx where ix =' ,
                  '(select max(ix) from A540769.tPer07x$tx)',
                  'with rr' ,
            , st , ':q$tx, :qu'
        end
    if q$fx > q$tx then
        say '<>' lx qt q$fx '>' q$tx qu
    if q$fx < q$tx then
        say '<>' lx qt q$fx '<' q$tx qu
    else if lx // 1000 = 0 then
        say '  ' lx qt q$fx '=' q$tx qu
    call sqlCommit
    $'$]'
$/w2/
$/ww/
call sqlDisconnect
$]
$#out                                              20101012 10:56:20
$#out                                              20101012 10:42:38
$#out                                              20101008 15:45:13
$#out                                              20101008 15:42:52
$#out                                              20101008 15:40:43