# Extracting Adabas packed value field in cobol program

**URL:** <https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-on-Mainframes, Adabas-Basics-on-Mainframes\
**Created:** [September 15, 2017, 1:14pm UTC](https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440 "2017-09-15T13:14:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maitree\_Priyadarsini1](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Maitree\_Priyadarsini1](https://techcommunity.softwareag.com/u/Maitree_Priyadarsini1)\
**Post date:** [September 15, 2017, 1:14pm UTC](https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440/1 "2017-09-15T13:14:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [September 18, 2017, 9:11pm UTC](https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440/2 "2017-09-18T21:11:36Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Maitree\_Priyadarsini1](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Maitree\_Priyadarsini1](https://techcommunity.softwareag.com/u/Maitree_Priyadarsini1)\
**Post date:** [September 19, 2017, 2:15am UTC](https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440/3 "2017-09-19T02:15:14Z")

</div>

> [@Wolfgang Winter](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:39pm UTC](https://techcommunity.softwareag.com/t/extracting-adabas-packed-value-field-in-cobol-program/196440/4 "2021-04-02T15:39:18Z")

</div>


