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

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

book

Article ID: 53907

calendar_today

Updated On:

Products

Datacom DATACOM - AD Datacom/AD Datacom/DB Datacom/Server

Issue/Introduction

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?

 

Environment

Release: Datacom

Resolution

Solution

By using the DBEDITS field attribute functionality of the Datadictionary, you can enable special 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):

  • Select the menu option for DBMAINT mode.



  • Select the menu option to maintain TABLEs.



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


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


  • 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.



  • 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.


Additional Information

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