This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to Define Default Value for Column in Relativity for a Cobol File?

I am using Relativity to define ISAM file.Below is one such exmaple:

 File structure [EMPLOYEE]

01  Record-1.

     02 EMP-ID         PIC 9(10).

     02 EMP-NAME PIC X(30).

     02 EMP-DEPT-CODE PIC 9(3).

Relativity Definition

TABLE : EMPLOYEE

EMP_ID      DECIMAL(10,0) PRIMARY KEY NOT NULL..

EMP_NAME CHAR(30) NOT NULL.

EMP_DEPT_CODE SMALLINT   NULLABLE.

When I am trying to INSERT Value. Insert query has only 2 columns. Insert query is failing for null value in EMP_DEPT_CODE.

INSERT INTO EMPLOYEEE (EMP_ID,EMP_NAME) VALUE ("ABC","SWAP")

My question : Is there a way to DEFAULT Value inserted into the column(s) not passed via Query? I saw Default Value column in File Definition portion of Relativity but it is not editable. 

Any help or guidance is highly appreciated.

### Above query is for reference only. Actual query has 100 columns.  

  • Swapnil,

    My point of reference is the Classic Designer.

    If a table is INSERTable then there is a "Default Value" column in the table definition.  If I recall, you click on the cell for the particular column to allow you to specify a default value.

    Not sure how this is presented in the new Designer.  But it definitely is a property that is associated with the column definition in the table, not on the File Definition.

  • Thanks Tom .. It is moved under FILE SECTION. It need to unable globally. I am able to do so. But stuck thereafter.

    I am getting only getting option Default Value Type = "ENTERED" for packed decimal/numeric. I entered Default Value = 0.Insert query failing with below message "Catalog invalid; catalog value length exceeds item length"

    Whereas for char fields I am getting option as LOW-VALUES,ZEROES,HIGH-VALUES,SAPCES,ENTERED.

  • Swapnil,

    In the Classic Designer the FD side also has a default value that can be related to a data item.  This default value is used during an insert when no value can be determined from the actual INSERT, typically because no column 'covers' the data item.

    The default value associated with a Column definition is used as a value for the column in the traditional SQL DDL sense, as you would specify in CREATE TABLE.  

    Please report the invalid catalog to support...that shouldn't happen.

  • Thanks Tom. I reported this.