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

DB2DatabaseBig Data Analytics

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 SQL
   SELECT INVOICE_ID INTO :INVOICE_ID_DATA :INVOICE_ID_N
   FROM ORDERS
      WHERE ORDER_ID = ‘678542112’
   END-EXEC
   IF INVOICE-ID-N = -1
   MOVE SPACES TO INVOICE-ID-DATA
END-IF

INVOICE-ID-N is a null indicator here which is generated automatically by DCLGEN utility.

raja
Published on 14-Sep-2020 14:52:04
Advertisements