# Adabas Date Field Data Equivalent

**URL:** <https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-on-Windows-UNIX, Adabas-Platforms\
**Created:** [November 2, 2011, 6:53pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863 "2011-11-02T18:53:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![santosh\_Potdar](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@santosh\_Potdar](https://techcommunity.softwareag.com/u/santosh_Potdar)\
**Post date:** [November 2, 2011, 6:53pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/1 "2011-11-02T18:53:58Z")

</div>

Hi,

I have a Date Field in Adabas having data type as Date and value as number like 730406.  
How to convert this number (730406) into equivalent MM/DD/YYYY format?  
Is this any mechanism\algorithm for this?

Thanks in advance for the help.

Regards,  
Santosh

---

<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:** [November 2, 2011, 7:30pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/2 "2011-11-02T19:30:37Z")

</div>

Is this Adabas on the mainframe or LUW (Linux / Unix / Windows) ?

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [November 2, 2011, 7:40pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/3 "2011-11-02T19:40:35Z")

</div>

You actually have a P4 in Adabas and D format for Natural if it contains a value like 730406.

Best thing you can do is read it with a Natural program which uses a DDM that points to this file and maps the shortname of this field to a D format DDM field. Then just read the file and display!

If you for some reason can’t use Natural, this is the number of days since a point of origin (Jan 2, year zero), and you can determine the date it represents by advancing that many days from the point of origin, ignoring actual changes in the calendar over time and ignoring the fact there was no such thing as year zero.

Today is 734807 (2 Nov 2011).

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [November 2, 2011, 7:46pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/4 "2011-11-02T19:46:28Z")

</div>

BTW, if you do this correctly, you can party like it’s 1999 because you will get 15 October 1999 as the answer.

---

<div class="post-metadata">

**Author:** ![santosh\_Potdar](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@santosh\_Potdar](https://techcommunity.softwareag.com/u/santosh_Potdar)\
**Post date:** [November 3, 2011, 6:02am UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/5 "2011-11-03T06:02:36Z")

</div>

Hi Brian,

Thank you very much for the prompt reply. This helps a lot.  
I am not a Natural expert hence I am asking for one more help.  
If you have the sample natural progarm ready with you that will do this converion, can you share the same?  
That will be of great help.

Thanks once again for helping.  
Really appreciated.

Regards,  
Santosh

---

<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:** [November 3, 2011, 9:23am UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/6 "2011-11-03T09:23:51Z")

</div>

> [@potdarsantosh@gmail.com](#):
>
> If you have the sample natural progarm ready with you that will do this converion, can you share the same?

What Brian said is:

define the date field as format ‘D’(ate) in the DDM / View,  
no extra conversion is required as Natural will do that for you.

Take the “BIRTH” field in DDM EMPLOYEES for an example, this is defined  
as format ‘D’, now create a simple program to read a few Employees  
records and WRITE the BIRTH field.

Regards,  
Wolfgang

---

<div class="post-metadata">

**Author:** ![Ats](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Ats](https://techcommunity.softwareag.com/u/Ats)\
**Post date:** [November 3, 2011, 10:18am UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/7 "2011-11-03T10:18:04Z")

</div>

Hi Santosh,

Your Natural DDM (for the Adabas file) should already have it defined as format D. You can verify it using “L V ddm-name” command, if so just write a simple program as below written for EMPLOYEES file given by SAG.

The below code is written in Reporting Mode (that can be invoked with GLOBALS SM=OFF command)

```auto
READ(10) EMPLOYEES
* WHERE BIRTH NE 0
  DISPLAY BIRTH
END
```

\*WHERE clause is written and can be used in case first 10 records are retrieved as 0 or blank

---

<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 3, 2011, 11:52am UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/8 "2011-11-03T11:52:00Z")

</div>

If you actually require an alpha field with the date, you can use some variation on the code below:

DEFINE DATA LOCAL  
1 #DATE-ALPHA (A8)  
END-DEFINE  
\*  
MOVE EDITED \*DATX (EM=YYYYMMDD) TO #DATE-ALPHA  
WRITE ‘=’ #DATE-ALPHA  
END  
Page 1 11/03/11 06:49:00

#DATE-ALPHA: 20111103

You can also redefine #DATE-ALPHA as #DATE-N (N8) and then redefine that to individual fields  
with numeric values for month and day and year.

steve

---

<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 3, 2011, 11:55am UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/9 "2011-11-03T11:55:54Z")

</div>

As an add-on to the code above, if you require the slashes in the alpha date field,

DEFINE DATA LOCAL  
1 #DATE-ALPHA (A10)  
END-DEFINE  
\*  
MOVE EDITED \*DATX (EM=MM’/‘DD’/'YYYY) TO #DATE-ALPHA  
WRITE ‘=’ #DATE-ALPHA  
END

Page 1 11/03/11 06:55:17

#DATE-ALPHA: 11/03/2011

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, 3:01pm UTC](https://techcommunity.softwareag.com/t/adabas-date-field-data-equivalent/98863/10 "2021-04-02T15:01:11Z")

</div>


