Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


Attributes of DDL table

Attributes of DDL table
Attributes of DDL table, ddl, sql, dds to ddl, dds to sql, database modernization, reocrd format in ddl table, db2, db2 for i sql, as400,ibmi
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

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain