Extracting Adabas packed value field in cobol program

Hi,

I have a Adabas file which has a field of N13.4. The valus stored for this field in the file is: 0.0100

EXEC ADABAS
FIND DECLARE A CURSOR
SELECT A
FROM FILE CURSORNAME
WHERE KEY=#KEY
OPTIONS DBID=XXXXX
END-EXEC.

The value of A is 0.0100 in the file. However, the above query is giving the value of 'A' as 0. 

 I have also checked the same using a natural program, which extracts the value correct.

Can someone please help me here.

I am getting a tough time.

Regards

Maitree

An ‘N’ field is not “packed”, it is a “zoned decimal” or, in COBOL terms, a “display” field.

What is the definition of ‘A’ in your COBOL program ?

Hi Wolfgang,

Thanks for your time. Yes, My bad. Its not packed. The definition of A is (N13.4).

However, the definition is not given explicitly in the cobol program. From the below select statement, cobol gets the value into ‘A’ from Adabas.

Also, one more observation is, its not always that I am facing the issue. For some of the records, I am facing this issue. The field works just perfect for most of the records. In some rare unknown scenario, I am facing this issue that the value is extracted as zero, even though there is a value in the adabas. Can it be related to “how the record got stored in adabas?”

EXEC ADABAS
FIND DECLARE A CURSOR
SELECT A
FROM FILE CURSORNAME
WHERE KEY=#KEY
OPTIONS DBID=XXXXX
END-EXEC.

Regards

Maitree