Mandalika has Published 470 Articles

What is the purpose of the "FOR UPDATE OF" clause in a cursor? What will happen if we fire an UPDATE statement without using this clause in a COBOL-DB2 program?

Mandalika

Mandalika

Updated on 15-Sep-2020 10:35:09

916 Views

The “FOR UPDATE OF” clause is given in the cursor declaration and it is used when we want to update the table. All the columns which need to be updated should be given in the cursor declaration.The “FOR UPDATE OF” clause will place the exclusive lock on all the qualifying ... Read More

How will you detect the condition of the end of cursor rows in a COBOL-DB2 program?

Mandalika

Mandalika

Updated on 14-Sep-2020 15:28:00

2K+ Views

The cursor can be used to fetch multiple rows from a DB2 table. However, we have to fetch this cursor in a loop so that values corresponding to a single row are assigned to host variables at a time. Based on this logic we have to process our loop till ... Read More

What are the steps involved to use a CURSOR in any COBOL-DB2 program?

Mandalika

Mandalika

Updated on 14-Sep-2020 15:22:57

9K+ Views

The CURSOR is used when we have to fetch multiple rows from a table. There are 4 steps involved in order to use a cursor in a COBOL-DB2 program.DECLARE cursor− In this step we will define the layout of the cursor. We will give the query we want to use. ... Read More

Explain the scenario in which CURSOR should be used over a standalone SELECT statement?

Mandalika

Mandalika

Updated on 14-Sep-2020 15:13:40

93 Views

The standalone SELECT statement is generally used when we use a primary or an alternate key in the WHERE clause. Therefore, In this case we are certain that the standalone select statement will return only one row since the primary key cannot have a duplicate value (multiple rows).If we want ... Read More

What we can conclude if the final value in the NULL indicator is -2?

Mandalika

Mandalika

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

1K+ Views

A NULL indicator is a 2 bytes field which serves the multiple purpose. This indicator takes the value as -1 when any DB2 column has NULL value and it takes the value as 0 when DB2 column has a non NULL value.Although the main purpose of the NULL indicator is ... Read More

What is the purpose of “NOT NULL WITH DEFAULT” clause used in DB2 table column?

Mandalika

Mandalika

Updated on 14-Sep-2020 15:02:16

1K+ Views

When we define the DB2 table, we can declare any column as “NOT NULL” which means that in any case this column cannot store NULL value.Now if we try to store a NULL value in this column in our COBOL-DB2 program using -1 value in the NULL indicator then our ... Read More

How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 program?

Mandalika

Mandalika

Updated on 14-Sep-2020 15:00:58

6K+ Views

We will make use of NULL indicator in order to store a NULL value in any column of a DB2 table. Firstly, we should move a value -1 in the NULL indicator in our COBOL-DB2 program. After that we execute UPDATE or INSERT query to store the NULL value.For example, ... Read More

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

449 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

2K+ 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

2K+ 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

Advertisements