# ACCEPT/REJECT

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.

Hi PalDesh,

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!

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.