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?
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.
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.
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.
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)
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