Create View and LF Non-Keyed in IBM i |
View and LF are applied to the existing tables to access their data more quickly and efficiently.
This article will cover the creation of the View and Non-key LF.
LF Non-Keyed
DDS File
A R RDDS8 A FLD1 10A TEXT('FIRST TEXT FLD') A COLHDG('FIRST' 'TEXT' 'FLD') A FLD2 2P 0 TEXT('FIELD2') A COLHDG('FIELD2')
To create the LF on the above DDS file PFILE keyword with the file name is used at the record level.
A R Record Formate PFILE(File Name)
Now, we will create the Non-Keyed LF on the above DDS file
Non-Keyed LF script
A R RDDS8 PFILE(DDS8) A FLD1 A FLD2
DSPFD on Non-keyed LF
View
DDL Table
CREATE TABLE LONGNAMETABLEDDL11( LONGNAMECOLUMN_FLD1 FOR COLUMN FLD1 CHAR(10) NOT NULL WITH DEFAULT, LONGNAMECOLUMN_FLD2 FOR COLUMN FLD2 DECIMAL(2) NOT NULL WITH DEFAULT ) RCDFMT RDDS8; LABEL ON LONGNAMETABLEDDL11( FLD1 IS 'FIRST TEXT FLD', FLD2 IS 'FIELD2' ); LABEL ON LONGNAMETABLEDDL11( FLD1 TEXT IS 'FIRST TEXT FLD', FLD2 TEXT IS 'FIELD2' ); RENAME LONGNAMETABLEDDL11 TO SYSTEM NAME DDL11;
To create the View on the above DDL table Create View keyword is used.
CREATE VIEW Long Name AS Select Query RCDFMT Record Formate
Now, we will create the View on the above DDL table.
View script
CREATE VIEW LONGNAMEVIEWDDL11VW1 AS SELECT FLD1,FLD2 FROM DDL11 RCDFMT RDDS8; RENAME LONGNAMEVIEWDDL11VW1 TO SYSTEM NAME DDL11VW1;
DSPFD on View
Related Post
Read also :
- CRTPF and Create Table in IBM i
- Primary Key in DDS and DDL tables
- Data Validation in DDS and DDL tables
- Column Heading in DDS Files and DDL tables
- Column Text in DDS and DDL tables
- Attributes of DDL table
- Auto-update Timestamp Column using ROW CHANGE TIMESTAMP in DDL table
- ADD Constraint in DDL tables
- Create Index and LF keyed in IBM i
- DDS to DDL Modernization : Level Check Error
- Identity column in DDL table
- QSQGNDDL API - IBM to convert DDS file into DDL table
- QSQGNDDL API - IBM to convert DDS file into DDL table (Continuing...)