I am adding a field to the end of a table definition in Datadictionary, but when I copy the Test status definition to Prod, I receive an error:
DDVTBL0004 TABLE LENGTH GREATER THAN MAXIMUM
Why did I get this, and how do I fix it?
The most likely cause for receiving this "DDVTBL0004 TABLE LENGTH GREATER THAN MAXIMUM" error during the copy to Prod process is that you have defined an attribute of the table (MAX-RECORD-SIZE) that limits its maximum length, and your current table length exceeds that limit.
From the CA Datacom/DB Database and System Administration Guide, in the section "Designing Tables › Minimum and Maximum Size for a Table:"
Specifying the Datadictionary TABLE attribute MAX-RECORD-SIZE allows you to reserve "growth space" for the table. Specifying a value greater than the sum of the lengths of the columns (fields) in the table allows you to define additional columns at a later time without expanding the physical record on disk. The additional space is included as undefined filler. If you do not specify a value, CA Datacom/DB uses the sum of the lengths of the columns as the length for the physical record.
This means that if the length of all the fields in a table is 65 bytes, and you know that a number of fields will be added to the end of this table, you can set the MAX-RECORD-SIZE to a higher number (100, for example), and when you allocate space for the database file, the Multi-User Facility (called MUF) and CXX will believe the record to be 100 bytes long. This allows you to change the table structure - adding fields to the end of the layout - without having to unload, reformat, and reload the data. However, these extra bytes, even though unused, still consume space on the volume. In the example above, a table length of 100 requires nearly 50% more space for each record than the default table length of 65 bytes.
In the case of this DDVTBL0004 error message, the Datadictionary program that verifies the attributes and definitions has identified that the total length of the fields on the table is greater than the value of the MAX-RECORD-SIZE attribute.
HOW TO RESOLVE THIS
There are three ways to resolve this situation and eliminate the error.
1. Change the table definition so that the sum of the field lengths does not exceed the MAX-RECORD-SIZE. This is most likely a poor choice unless there are obsolete fields that can be removed, making room for the fields being added. Reformatting the data is likely with this option.
2. Change the MAX-RECORD-SIZE to a new value that is at least as much as the current sum of the field lengths.
3. Change the MAX-RECORD-SIZE to zero, and let the Datadictionary programs determine the absolute record size. This means that you would most likely need to reformat the records using DDRMFLM or your own utility with each change to the table definition, but provides the best space utilization without any extra unusable space in each record. This is our usual recommendation, and is the default for new tables that are created.
To review the MAX-RECORD-SIZE for each of the Tables within all versions of a Database, run the DDUTILTY program with this input:
//SYSIN DD * -USR DATACOM-INSTALL,NEWUSER -DEF PATH,STANDARD -END -RPT START,DATABASE,xxxxxxxx(ALL),STANDARD -RPT DETAIL,TABLE -END /*
To change the MAX-RECORD-SIZE for a table, update the value on the Attribute Update panel in DDOL (mode Entity Maintenance, and the Update Attribute option), or run the DDUPDATE program with this input. You will need a set of transactions (other than the -USR transaction) for each table being changed. If your change will cause the CXX record length to be different, it should be changed in Test status--our example will use T001:
//SYSIN DD * -USR DATACOM-INSTALL,NEWUSER -UPD TABLE,tttttttt(T001) 3151 00000 -END /*
The 5 digits starting at position 6 on the 3151 transaction should be set to the desired value, from 00001 to 32720 if you specify an absolute record length, or set to zero (00000) to use the recommended default setting.
Important! If you update an attribute that changes the physical layout or length of the record, see the sections on modifying CA Datacom Datadictionary in the CA Datacom/DB Database and System Administration Guide
For more information about changing the MAX-RECORD-SIZE please refer to the CA Datacom Datadictionary Batch Reference Guide, in the section "DDUPDATE - Updating Datadictionary › 3150 to 3160 TABLE Transactions › 3151 TABLE Transaction."