zOs/TX/TBADPDDL

set current sqlid = 'S100447';
DROP TABLESPACE  $db.aTbAdP  ;
COMMIT ;

$= parts =- if($env='src', $partsS, $partsT)
$= freePg =- if($env='src', 0, 77)
$@ say $env 'parts='$parts 'freePage='$freePg
$@ if $phase >= 1 then $@=/p1/
CREATE TABLESPACE aTbAdP
    IN $db
    USING STOGROUP GSMS
    PRIQTY -1 SECQTY -1
    GBPCACHE CHANGED
    TRACKMOD NO
    LOGGED
    BUFFERPOOL BP2
    LOCKSIZE ANY
    LOCKMAX SYSTEM
    CLOSE YES
    COMPRESS YES
    CCSID      ebcdic
    DEFINE YES
    SEGSIZE 64   -- segmented
    numParts $partsT
    dssize 16 g
    MAXROWS 255
    FREEPAGE $freePg
;
CREATE TABLE $creator.tqz91tbAdP
    ( pa smallint not null
    , c2 char(10) not null with default
    , c3 char(10) not null with default
    )
        IN $db.aTbAdP
    partition by (pa)
    ( partition 1 ending at (1)
$do px=2 to $partsT $@=[
    , partition $px ending at ($px)
    $]
    )
   CCSID         EBCDIC
;
CREATE UNIQUE INDEX $creator.Iqz91tbAdPA1
           ON $creator.tqz91tbAdP
          (pa, c2) partitioned
           CLUSTER
           DEFINE YES
           COMPRESS NO
           BUFFERPOOL BP1
           CLOSE YES
           DEFER NO
           COPY NO
           USING STOGROUP "GSMS    "
               PRIQTY -1
               SECQTY -1
               ERASE NO
           FREEPAGE $freePg
           GBPCACHE CHANGED
;
commit;
$do px= $partsT+1 to $parts $@=[
alter table $creator.tqz91tbAdP
    add partition ending at ($px);
    $]
commit;

insert into $creator.tqz91tbAdP  values(1, 'zehn', '10');
$do px=1 to $parts $@=[
insert into $creator.tqz91tbAdP  values($px, 'c1 ' || $px || 'a'
                                           , 'c2 ' || $px || 'b');
insert into $creator.tqz91tbAdP  values($px, 'c1 ' || $px || 'e'
                                           , 'c2 ' || $px || 'f');
$]
commit;
$/p1/