#as400 #VSAS400Coding #PowerSystemCodingThroughVS #visualstudio2022 #SQL #TrendingAS400 #AS400-TUTORIAL
Create table in in AS400 USING RUNSQL STM:
1. Create source member SQLTAB4(e.g.) of typr QRY in AS400.
2. Write code into SQLTAB4 for creating table INVENTORY1.
SQLTAB4
...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
************** Beginning of data ************************************
-- CREATE INVETORY TABLE
-- IN JOGI1 LIBRARY
CREATE TABLE INVENTORY1
(PARTNO SMALLINT NOT NULL,
DESCR VARCHAR(24),
QONHAND INT)
***************** End of data ***************************************
3.Compile SQLTAB4 Qry member o create table using below command -
RUNSQLSTM SRCFILE(JOGI1/QSQLSRC) SRCMBR(SQLTAB4)
4. Check file and fill data into INVENTORY1.
select * from jogi1.INVENTORY1;
insert into jogi1.INVENTORY1
values (1,'kela', 400),
(2,'Bhela', 400),
(3,'Khela', 400),
(4,'Dhela', 1000000);
select * from jogi1.INVENTORY1;
5.Create table INVENTORY2 in JOGI1 library. You need to give your library in place Jogi1.
SQLTAB4
...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
************** Beginning of data ************************************
-- CREATE INVETORY TABLE
-- IN JOGI1 LIBRARY
CREATE TABLE INVENTORY2
(PARTNO SMALLINT NOT NULL,
DESCR VARCHAR(24),
QONHAND INT)
***************** End of data ***************************************
6. RUNSQLSTM SRCFILE(JOGI1/QSQLSRC) SRCMBR(SQLTAB4)
7. Check file and fill data into INVENTORY2.
select * from jogi1.INVENTORY2;
insert into jogi1.INVENTORY2
values (1,'kela', 400),
(2,'Bhela', 400),
(3,'Khela', 400),
(4,'Dhela', 1000000);
select * from jogi1.INVENTORY2;