# ACCEPT/REJECT

**URL:** <https://techcommunity.softwareag.com/t/accept-reject/94995>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [October 14, 2010, 5:38pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995 "2010-10-14T17:38:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PalDesh](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@PalDesh](https://techcommunity.softwareag.com/u/PalDesh)\
**Post date:** [October 14, 2010, 5:38pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995/1 "2010-10-14T17:38:54Z")

</div>

Hi,  
I have a code  
REJECT IF Variable =1  
REJECT IF Variable =2  
REJECT IF Variable =3  
REJECT IF Variable =4  
REJECT IF Variable =5  
REJECT IF Variable =6

Move ‘y’ to ws-proceed.

Accept If variable2= B  
Reject IF caraible2= C  
This is processed in a loop for each record in a input file. Will all the reject/accept statements be processed.

---

<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:** [October 14, 2010, 6:33pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995/2 "2010-10-14T18:33:33Z")

</div>

Hi PalDesh,

I want to see your statement which read data records.

However, at this time I can say:

Normally, only one ACCEPT or REJECT statement is required in a single processing loop. If more than one ACCEPT/REJECT is specified consecutively, the following conditions apply:

■ If consecutive ACCEPT and REJECT statements are contained in the same processing loop, they are processed in the specified order.  
■ If an ACCEPT condition is satisfied, the record will be accepted and consecutive ACCEPT/REJECT statements will be ignored.  
■ If a REJECT condition is satisfied, the record will be rejected and consecutive ACCEPT/REJECT statements will be ignored.  
■ If the processing continues to the last ACCEPT/REJECT statement, the last statement will determine whether the record is accepted or rejected.

If other statements are interleaved between multiple ACCEPT/REJECT statements, each ACCEPT/REJECT will be handled independently.

Hope this helps!

---

<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:** [October 14, 2010, 7:09pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995/3 "2010-10-14T19:09:05Z")

</div>

That is really a confusing piece of code. The casual observer is not necessarily going to know what happens, for example, when the conditions REJECT IF VARIABLE1 = ‘X’ and ACCEPT IF VARIABLE2 = ‘Y’ both evaluate to TRUE unless they happen to be up on exactly how multiple ACCEPT/REJECT statements are processed when scattered throughout your loop.

If you were to code the intended logic into one ACCEPT/REJECT statement, or better yet in my view one single conditional block like this:

IF (VARIABLE1 \> ‘A’ AND VARIABLE2 \< ‘F’) OR (VARIABLE2 = ‘X’ AND VARIABLE1 = ‘Y’)  
ESCAPE TOP  
END-IF

…it would be a lot more easily understood what is going on. If it is intended that some lines be executed, you can create another escape top condition after and not be confused on the order of ACCEPT/REJECT processing.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [October 14, 2010, 7:43pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995/4 "2010-10-14T19:43:17Z")

</div>

[http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat426mf2/sm/accept.htm#accept-multiple-statement-proc](http://techcommunity.softwareag.com/ecosystem/documentation/natural/nat426mf2/sm/accept.htm#accept-multiple-statement-proc)

---

<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:59pm UTC](https://techcommunity.softwareag.com/t/accept-reject/94995/5 "2021-04-02T14:59:13Z")

</div>


