Attributes of DDL table |
DDL table attributes
DDL table is formed with the help of SQL, so it is also called SQL table. A DDL table consists of many segments and in this article, we will walk through some of those functionalities.
Today you will learn how to provide long names to the tables and fields, about record formates also about renaming the system name.
So, let's start...
Table long name
A long can be given to the DDL table through below shown code
CREATE TABLE LONGNAMETABLEDDL7
Field long name
A long name can be provided to the field through FOR COLUMN on short field names.
LONGNAMECOLUMN_FLD1 FOR COLUMN FLD1
Record format
Record format in the DDL files can be given through
RCDFMT RDDS7
Renaming system name
We have a table long name and it should be provided with a short name also
RENAME LONGNAMETABLEDDL7 TO SYSTEM NAME DDL7
Complete DDL table script
Below is the complete DDL table script with the combination of all the above-mentioned functionalities.
CREATE TABLE LONGNAMETABLEDDL7 ( LONGNAMECOLUMN_FLD1 FOR COLUMN FLD1 CHAR(10) NOT NULL WITH DEFAULT UNIQUE, LONGNAMECOLUMN_FLD2 FOR COLUMN FLD2 DECIMAL(2) NOT NULL WITH DEFAULT ) RCDFMT RDDS7; LABEL ON LONGNAMETABLEDDL7 ( FLD1 IS 'FIRST TEXT FLD', FLD2 IS 'FIELD2' ); LABEL ON LONGNAMETABLEDDL7 ( FLD1 TEXT IS 'FIRST TEXT FLD', FLD2 TEXT IS 'FIELD2' ); RENAME LONGNAMETABLEDDL7 TO SYSTEM NAME DDL7;
Below is the DSPFFD of the above mention DDL SQL script
Field Level Information Data Field Buffer Buffer Field Column Field Type Length Length Position Usage Heading FLD1 CHAR 10 10 1 Both FIRST TEXT FLD Field text . . . . . . . . . . . . . . . : FIRST TEXT FLD Alternative name . . . . . . . . . . . . : LONGNAMECOLUMN_FLD1 Coded Character Set Identifier . . . . . : 273 Data Field Buffer Buffer Field Column Field Type Length Length Position Usage Heading FLD2 PACKED 2 0 2 11 Both FIELD2 Field text . . . . . . . . . . . . . . . : FIELD2 Alternative name . . . . . . . . . . . . : LONGNAMECOLUMN_FLD2
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
- Auto-update Timestamp Column using ROW CHANGE TIMESTAMP in DDL table
- ADD Constraint in DDL tables
- Create Index and LF keyed in IBM i
- Create View and LF Non-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...)