Can I set a field in a CA-Datacom/DB table to default to spaces if data is not explicitly entered during INSERT or ADDIT processing?

Document ID : KB000053907
Last Modified Date : 14/02/2018
Show Technical Document Details


When defining a character field in a table, is there a way for certain fields to default to spaces if nothing is put into the field through application programs?


By using the DBEDITS field attribute functionality of the Datadictionary, you can enable special CA-Datacom/DB processing for both data editing and default processing. For example, a field can be defined to allow nulls or not. It can also be set to use various defaults, based on the type of data stored in the field.

To add this functionality to a field, use the Batch Datadictionary FIELD maintenance transaction 4012, or follow this process through Datadictionary Online (DDOL):

  1. Select the menu option for DBMAINT mode.

Figure 1

  • Select the menu option to maintain TABLEs.

Figure 2

  • Select the menu option to DISPLAY FIELDS, then enter the desired table name information to be maintained.

Figure 3

Figure 4

  • Enter the line command ATT beside the character field you wish to change.

Figure 5

  • Enter 'Y'  in the DBEDITS field, 'O' in the DEFAULT-INSERT field (to indicate a User-Defined default value exists), and the keyword SPACE or SPACES in the VALUE field.

Figure 6

  • Apply as usual, and follow your standard table change promotion procedure.
  • Be aware that if you change the attributes of a field for an existing table, you need to review programs that maintain this table to ensure that your changes are compatible with your current processing.

    For further information about the values of the various FIELD attributes, please refer to the CA Datacom Datadictionary Attribute Reference Guide.
    For further information about Default values and FIELD edit criteria, please refer to the CA Datacom/DB Database and System Administrator Guide.
    For further information about using batch Datadictionary Maintenance transactions, please refer to the CA Datacom/DB Datadictionary Batch Guide.