# Numeric to packed

**URL:** <https://techcommunity.softwareag.com/t/numeric-to-packed/75768>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [November 28, 2007, 1:23am UTC](https://techcommunity.softwareag.com/t/numeric-to-packed/75768 "2007-11-28T01:23:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![virtuesplea1](https://avatars.discourse-cdn.com/v4/letter/v/59ef9b/32.png) [@virtuesplea1](https://techcommunity.softwareag.com/u/virtuesplea1)\
**Post date:** [November 28, 2007, 1:23am UTC](https://techcommunity.softwareag.com/t/numeric-to-packed/75768/1 "2007-11-28T01:23:16Z")

</div>

I need to read a table and pick out those records that were updated on the current date. In this table, the field that contains the date is a descriptor field, but it is also a packed field - depending on the table, it’s either (p12.0) or (p8.0). Since it’s a packed field, I’d like to convert the date (say, \*datn) to a packed field so that I can do the read directly, instead of reading each record in the table, converting the packed date to a n8.0 or n12.0, and then comparing that number with today’s date.

READ table\_name BY packed\_date = #today\_packed  
END READ

So how might I go about converting a number to a packed number? Or is there a better way to go about this?

Thanks in advance for the help.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [November 28, 2007, 1:37am UTC](https://techcommunity.softwareag.com/t/numeric-to-packed/75768/2 "2007-11-28T01:37:53Z")

</div>

#today\_packed (p8) := _DATN  
read table\_name by packed\_date = #today\_packed /_ or find…  
etc…

You don’t need to convert to unpacked to do the comparison.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [November 28, 2007, 2:22am UTC](https://techcommunity.softwareag.com/t/numeric-to-packed/75768/3 "2007-11-28T02:22:11Z")

</div>

How is the field that contains the date “encoded”? P8 I can understand, something like YYYYMMDD; but what is the coding for a P12 field?

steve

---

<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, 2:48pm UTC](https://techcommunity.softwareag.com/t/numeric-to-packed/75768/4 "2021-04-02T14:48:57Z")

</div>


