Regarding ACCEPT/REJECT statement?

Hi all,

My query–>
What is the difference in using an IF statement and using an ACCEPT/REJECT statement?

The documentation states:

I hope this helps
Regards,
Michael

AFAIK there are no major differences between an IF and ACCEPT REJECT. You can express each ACCEPT or REJECT-Statement with an IF-Statement. Both have no influence of *COUNTER/*NUMBER (i.e. the number of processing loops).

The only thing you have to think about is the following (according to the documentation):

Does it mean the only difference is that →

By using an IF statement we can perform a set of instructions/intruction (depending upon the logical condition of IF statement)

But by using an ACCEPT/REJECT we cannot perform a set of instructions/intruction, only thing it can do is to accept or reject a record based on a logical condition.

Correct! I guess the right of ACCEPT/REJECT to exist is, that it is more compact. Example:

REJECT IF criterion1
REJECT IF criterion2
ACCEPT IF criterion3

does the same as

IF criterion1
  ESCAPE TOP
ELSE
  IF criterion2
    ESCAPE TOP
  ELSE
    IF NOT criterion 3
      ESCAPE TOP
    END-IF
  END-IF
END-IF

… and then there is the possible problem if the hierarchy of accept/reject is not correct.

Is it true —>

“ACCEPT/REJECT does not write in the buffer ,i.e. , if a condition of REJECT IF statement is satisfied than data wont be written in the buffer and same is the case when condition of ACCEPT IF statement is not satisfied.”

Is it true —>

“ACCEPT/REJECT does not write in the buffer ,i.e. , if a condition of REJECT IF statement is satisfied than data wont be written in the buffer and same is the case when condition of ACCEPT IF statement is not satisfied.”

Not true. ACCEPT/REJECT are statements within a loop. A record gets read at the beginning of the loop.