Start of change

Example: Program definitions

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
Figure 1. Create a collection and tables
/******************************************************************************/
/* Local Database                                                             */
/******************************************************************************/
CREATE COLLECTION DRDA                                                         

CREATE TABLE DRDA/PART_STOCK (PART_NUM   CHAR(5)   NOT NULL,
                              PART_UM    CHAR(2)   NOT NULL,
                              PART_QUANT INTEGER   NOT NULL WITH DEFAULT,                         
                              PART_ROP   INTEGER   NOT NULL,                                      
                              PART_EOQ   INTEGER   NOT NULL,                                      
                              PART_BIN   CHAR(6)   NOT NULL WITH DEFAULT                          
                             )                                                               

CREATE UNIQUE INDEX DRDA/PART_STOCI ON DRDA/PART_STOCK (PART_NUM ASC)                                                 

/******************************************************************************/
/* Remote Database                                                            */
/******************************************************************************/
CREATE COLLECTION DRDA                                                         

CREATE TABLE DRDA/PART_ORDER (ORDER_NUM  SMALLINT  NOT NULL,
                              ORIGIN_LOC CHAR(4)   NOT NULL,
                              ORDER_TYPE CHAR(1)   NOT NULL,
                              ORDER_STAT CHAR(1)   NOT NULL,
                              NUM_ALLOC  SMALLINT  NOT NULL WITH DEFAULT,
                              URG_REASON CHAR(1)   NOT NULL WITH DEFAULT,
                              CREAT_TIME TIMESTAMP NOT NULL,
                              ALLOC_TIME TIMESTAMP,
                              CLOSE_TIME TIMESTAMP,
                              REV_REASON CHAR(1) 
                             ) 

CREATE UNIQUE INDEX DRDA/PART_ORDEI ON DRDA/PART_ORDER (ORDER_NUM ASC)                                                

CREATE TABLE DRDA/PART_ORDLN (ORDER_NUM  SMALLINT  NOT NULL,
                              ORDER_LINE SMALLINT  NOT NULL,
                              PART_NUM   CHAR(5)   NOT NULL,
                              QUANT_REQ  INTEGER   NOT NULL,                                           
                              LINE_STAT  CHAR(1)   NOT NULL                                       
                             )                                                               

CREATE UNIQUE INDEX PART_ORDLI ON DRDA/PART_ORDLN (ORDER_NUM ASC,
                                                   ORDER_LINE ASC)                                               

CREATE TABLE DRDA/SHIPMENTLN (SHIP_NUM   SMALLINT  NOT NULL,
                              SHIP_LINE  SMALLINT  NOT NULL,
                              ORDER_LOC  CHAR(4)   NOT NULL,
                              ORDER_NUM  SMALLINT  NOT NULL,
                              ORDER_LINE SMALLINT  NOT NULL,
                              PART_NUM   CHAR(5)   NOT NULL,
                              QUANT_SHIP INTEGER   NOT NULL,                                           
                              QUANT_RECV INTEGER   NOT NULL WITH DEFAULT                               
                             )                                                               

CREATE UNIQUE INDEX SHIPMENTLI ON DRDA/SHIPMENTLN (SHIP_NUM ASC,                                                          
                                                   SHIP_LINE ASC)         
Figure 2. Insert data into the tables
/******************************************************************************/
/* Local Database                                                             */
/******************************************************************************/
/******************************************************************************/
/* PART_STOCK                                                                 */
/******************************************************************************/
INSERT INTO DRDA/PART_STOCK VALUES('14020','EA',038,050,100,' ')      

INSERT INTO DRDA/PART_STOCK VALUES('14030','EA',043,050,050,' ')      

INSERT INTO DRDA/PART_STOCK VALUES('14040','EA',030,020,030,' ')      

INSERT INTO DRDA/PART_STOCK VALUES('14050','EA',010,005,015,' ')      

INSERT INTO DRDA/PART_STOCK VALUES('14060','EA',110,045,090,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('14070','EA',130,080,160,' ')     
  
INSERT INTO DRDA/PART_STOCK VALUES('18020','EA',013,025,050,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('18030','EA',015,005,010,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('21010','EA',029,030,050,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('24010','EA',025,020,040,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('24080','EA',054,050,050,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('24090','EA',030,025,050,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('24100','EA',020,015,030,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('24110','EA',052,050,080,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('25010','EA',511,300,600,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('36010','EA',013,005,010,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('36020','EA',110,030,060,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('37010','EA',415,100,200,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('37020','EA',010,020,040,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('37030','EA',154,055,060,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('37040','EA',223,120,120,' ')     

INSERT INTO DRDA/PART_STOCK VALUES('43010','EA',110,020,040,' ')    

INSERT INTO DRDA/PART_STOCK VALUES('43020','EA',067,050,050,' ')    

INSERT INTO DRDA/PART_STOCK VALUES('48010','EA',032,030,060,' ')    
 

/******************************************************************************/
Figure 3. Insert data into the tables (continued)
/* Remote Database                                                            */
/******************************************************************************/
/******************************************************************************/
/* PART_ORDER TABLE                                                           */
/******************************************************************************/
INSERT INTO DRDA/PART_ORDER VALUES(1,'DB2B','U','O',0,' ','1991-03-12-17.00.00',
                              NULL,NULL,NULL) 

INSERT INTO DRDA/PART_ORDER VALUES(2,'SQLA','U','O',0,' ','1991-03-12-17.01.00',
                              NULL,NULL,NULL)   

INSERT INTO DRDA/PART_ORDER VALUES(3,'SQLA','U','O',0,' ','1991-03-12-17.02.00',
                              NULL,NULL,NULL)   

INSERT INTO DRDA/PART_ORDER VALUES(4,'SQLA','U','O',0,' ','1991-03-12-17.03.00',
                              NULL,NULL,NULL)   

INSERT INTO DRDA/PART_ORDER VALUES(5,'DB2B','U','O',0,' ','1991-03-12-17.04.00',
                              NULL,NULL,NULL)   

 
/******************************************************************************/
/*  PART_ORDLN TABLE                                                          */
/******************************************************************************/
INSERT INTO DRDA/PART_ORDLN VALUES(1,1,'24110',005,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(1,2,'24100',021,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(1,3,'24090',018,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(2,1,'14070',004,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(2,2,'37040',043,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(2,3,'14030',015,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(3,2,'14030',025,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(3,1,'43010',003,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(4,1,'36010',013,'O') 

INSERT INTO DRDA/PART_ORDLN VALUES(5,1,'18030',005,'O') 
 
 
/******************************************************************************/
/* SHIPMENTLN TABLE                                                           */
/******************************************************************************/
INSERT INTO DRDA/SHIPMENTLN VALUES(1,1,'DB2B',1,1,'24110',5,5)      

INSERT INTO DRDA/SHIPMENTLN VALUES(1,2,'DB2B',1,2,'24100',10,1)     

INSERT INTO DRDA/SHIPMENTLN VALUES(2,1,'SQLA',2,1,'14070',4,4)      

INSERT INTO DRDA/SHIPMENTLN VALUES(2,2,'SQLA',2,2,'37040',45,25)    

INSERT INTO DRDA/SHIPMENTLN VALUES(2,3,'SQLA',2,3,'14030', 5,5)     

INSERT INTO DRDA/SHIPMENTLN VALUES(3,1,'SQLA',2,3,'14030', 5,5)     
End of change