# Data Archival selection criteria: less than January 1 of x years ago

**URL:** <https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Add-on-Products, Adabas-Distributed-Data\
**Created:** [July 30, 2018, 5:17pm UTC](https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294 "2018-07-30T17:17:51Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [July 30, 2018, 5:17pm UTC](https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294/1 "2018-07-30T17:17:51Z")

</div>

One enhancement had been made for a use case we had at the time where if we were running an archival extraction, and we wanted to archive 3 years ago or more if it was before the 1st of the month, we could specify this (AI is a D format - P4 in ADABAS - field):

EXTRACT fin\_trans\_xref\_prod(fin\_trans\_xref\_prod.AI \< TODAY(-3Y,DATX,”DD=01”))

Now we have a use case where we want to only extract records if it was before January 1, three years ago. I have tried all kinds of things like (AB is a D format - P4 in ADABAS - field):

EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,”MM=01,DD=01"))  
EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,”MM=01 DD=01"))  
EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,”MM=01",“DD=01”))  
EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,”MMDD=0101"))

I cannot figure out how to do this, and the ADRExtractionSyntaxReference.pdf doesn’t seem to give any clues. Is this even possible? Seems this would be a common archival rule to apply.

Please advise.

Thanks,

Brian

---

<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:** [July 30, 2018, 5:22pm UTC](https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294/2 "2018-07-30T17:22:48Z")

</div>

Helps if I use single quotes inside the selection criteria. It accepted this:

EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,‘MM=01,DD=01’))

---

<div class="post-metadata">

**Author:** ![Geoff\_Naylor1](https://avatars.discourse-cdn.com/v4/letter/g/dc4da7/32.png) [@Geoff\_Naylor1](https://techcommunity.softwareag.com/u/Geoff_Naylor1)\
**Post date:** [July 31, 2018, 5:13pm UTC](https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294/3 "2018-07-31T17:13:04Z")

</div>

Hi Brian,  
Double quotes are the correct way to define the selection criteria.

So the following should be ok:  
EXTRACT sp\_adjustments\_prod(sp\_adjustments\_prod.AB \< TODAY(-3Y,DATX,“MM=01,DD=01”))

Looking closely at your failing syntax examples, it looks like the double quote which precedes the MM= parameter is of a different (wrong) format to the other (correct) double quotes eg. the one following the DD=01 parameter…

I believe this may be the cause of the problem.

---

<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:41pm UTC](https://techcommunity.softwareag.com/t/data-archival-selection-criteria-less-than-january-1-of-x-years-ago/200294/4 "2021-04-02T15:41:07Z")

</div>


