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.
Setting the value higher than the sum will again result in unusable space in each record, and you will need to reformat the data to accommodate the new
record length. This is not a very common practice.
Setting the value equal to the current record length will prevent this error now, but it would have to be changed with every change to your table
definition. In this case, the next option is likely to provide the most benefit.
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 *
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 *
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.
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."