DDS to DDL Modernization : Level Check Error

DDS to DDL Modernization : Level Check Error
DDS to DDL Modernization - Level Check Error, level check error, dds to ddl conversion problems, ibmi, as400, db2,db2forisql, sql, dds to sql
DDS to DDL Modernization - Level Check Error 

Introduction

When the DDS file gets converted to the DDL table then Level Check Error is very common. And, one can remove this error by just re-compiling all the dependent programs on the file.

But, what if the dependency of the file is huge and can't compile all of them at once.

Level Check Error comes due to a change in the Format Level Identifier of the file. 

Then the concept of surrogate LF comes into the picture. Surrogate LF is the PF's that are now converted to LF's.

Here, a new DDL table is created with the same fields as in the DDS PF file. We can add new fields also in the new DDL table but can't remove the fields that are present in the DDS PF file. Further after the creation of the DDL table, the DDS PF file is converted to LF pointing to the newly created DDL table.

DDS to DDL Modernization

Existing PF and LF files structure

DDS PF file

A          R RDDS9
A            FLD1          10A         TEXT('FIRST TEXT FLD')       
A                                      COLHDG('FIRST' 'TEXT' 'FLD') 
A            FLD2           2P 0       TEXT('FIELD2')               
A                                      COLHDG('FIELD2')               

DDS LF file

A          R RDDS9                     PFILE(DDL9)
A          K FLD1                                             

Newly Created DDL Table

Now, we will create a new DDL table based on the above DDS PF file but there will be an addition of an extra field.

CREATE TABLE LONGNAMETABLEDDL12(                                       
  LONGNAMECOLUMN_FLD1 FOR COLUMN FLD1 CHAR(10) NOT NULL WITH DEFAULT,  
  LONGNAMECOLUMN_FLD2 FOR COLUMN FLD2 DECIMAL(2) NOT NULL WITH DEFAULT,
  LONGNAMECOLUMN_FLD3 FOR COLUMN FLD3 DECIMAL(2) NOT NULL WITH DEFAULT 
                  )                                                    
                  RCDFMT RDDS9;                                        
   LABEL ON LONGNAMETABLEDDL12(                                        
     FLD1 IS 'FIRST               TEXT                FLD',            
     FLD2 IS 'FIELD2',                                                 
     FLD3 IS 'FIELD3'                                                  
                 );                                                    
   LABEL ON LONGNAMETABLEDDL12(                                        
     FLD1 TEXT IS 'FIRST TEXT FLD',                                    
     FLD2 TEXT IS 'FIELD2',                                            
     FLD3 TEXT IS 'FIELD3'                                             
                 );                                                    
                                                                       
   RENAME LONGNAMETABLEDDL12 TO SYSTEM NAME DDL12;                     

Conversion of DDS PF file to surrogate LF 

The existing DDS PF file now is converted to surrogate LF. 
To do that first delete the object of the existing DDS PF file and DDS LF file and further PFILE keyword will be added to the DDS PF file pointing to the newly created DDS table.
A          R RDDS9                     PFILE(DDL12)                
A            FLD1          10A         TEXT('FIRST TEXT FLD')      
A                                      COLHDG('FIRST' 'TEXT' 'FLD')
A            FLD2           2P 0       TEXT('FIELD2')              
A                                      COLHDG('FIELD2')            

Code Changes in DDS LF file   

And still, we have a DDS LF file to convert that, FORMAT keyword is used with the existing DDS PF file that is converted to surrogate LF also the pointing of the PFILE keyword will be changed to the new DDL table.
A          R RDDS9                     PFILE(DDL12) 
A                                      FORMAT(DDS9) 
A          K FLD1                                   

Conclusion

There will be no Format Level Identifier change for the DDS PF file (surrogate LF) and DDS LF files so, no need for the compilation of the dependent programs.

Related Post

Post a Comment

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