Mandalika has Published 473 Articles

What is the result of count function in the NULL value present in DB2 table?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:57:50

324 Views

The COUNT function in DB2 is used to return the number of rows which satisfies the given criteria. The GROUP BY is used to divide the rows in the groups based on the criteria given in the query.If we perform the GROUP BY on INVOICE_ID and there are few rows ... Read More

What will happen if a NULL value is detected for a SQL statement in COBOL-DB2 program and the NULL indicator is not used?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:54:26

1K+ Views

There is no concept of NULL in COBOL language. Therefore, if any of the columns in DB2 table can hold NULL value then we need to give the NULL indicator in SELECT query in order to detect the NULL value.However, if we miss to give the null indicator in the ... Read More

How to verify NULL value in DB2 column data using COBOL paragraph?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:52:20

1K+ Views

In order to accomplish this, we will make use of NULL indicator after the SELECT query on the INVOICE_ID of the ORDERS table. If the NULL indicator has the value as -1 then we can conclude that INVOIVE_ID has a null value.Below is a COBOL paragraph for this−A010-CHECK-ORDER.    EXEC ... Read More

How will the COBOL-DB2 program behave when there is a mismatch between the host variable and number of columns in the SELECT statement?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:44:03

471 Views

In case there is a mismatch in the number of columns and number of host variables, the query will fail. There are two ways in which we can detect this condition.The SQLWARN3 field of SQLCA will get the value as ‘W’ in case there is a mismatch.In some installations the ... Read More

How does DCLGEN utility accommodate NULL host variable for VARCHAR(n) data type?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:39:55

1K+ Views

The DB2 column can store NULL value if it is explicitly not defined with the ‘NOT NULL’ option. However, COBOL does not have any NULL concept. In order to handle these NULL values, COBOL programs use spaces for character columns and zeros for integer columns having NULL value.However, the main ... Read More

Convert DECIMAL(7,3) into equivalent COBOL host variable PIC form.

Mandalika

Mandalika

Updated on 14-Sep-2020 14:30:09

1K+ Views

The formula for converting DECIMAL DB2 data type to COBOL equivalent is−DECIMAL(p,q) = PIC S9(p-q)V(q). Where V indicates implied decimal.The DECIMAL(7,3) can take a sample value as 7861.237 and this can be converted to COBOL equivalent as PIC S9(7-3)V(3) = PIC S9(4)V(3).

What are the COBOL host variable equivalent for various DB2 data types?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:28:07

585 Views

The host variables are used to transfer the data from DB2 to program and vice versa.For each DB2 table column we have a COBOL equivalent host variable defined. The host variables can be generated automatically using the DCLGEN utility or we can explicitly give the host variables in the working ... Read More

What are the default values used by DB2 for various data types?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:21:06

848 Views

DB2 provides a facility to insert a default value in case the user does not give any value for the column. For each DB2 data type there is a fixed default value which will be assigned to the column (which was defined with ‘DEFAULT’ parameter during table creation) if the ... Read More

What is NULL check and insertion rule in a DB2 table?

Mandalika

Mandalika

Updated on 14-Sep-2020 14:06:49

382 Views

Null in DB2 is defined as nothing. It is an unknown value. If we want to restrict NULL value in any column then the column should be defined with the “NOT NULL” parameter in CREATE TABLE.The “NOT NULL” will force the user to enter a value for the column. However, ... Read More

What is CASCADE rule for the foreign key on one table referencing to another table?

Mandalika

Mandalika

Updated on 14-Sep-2020 13:57:08

2K+ Views

The foreign key is used to establish a referential constraint between the child table(in which column is defined as foreign key) and parent table (in which foreign key of the child table becomes primary key). For example if we have an ORDER table in which foreign key is defined as ... Read More

Advertisements