ACCEPT/REJECT from ADABAS point of view

What is the difference b/w following 2 codes

READ PRODUCT WITH PRODUCT-CODE
IF PRODUCT-CODE NE ‘1000’
ESCAPE TOP
END-IF

END-READ

READ PRODUCT WITH PRODUCT-CODE
ACCEPT IF PRODUCT-CODE EQ ‘1000’

END-READ

Apart from the fact that it’s bad style anyway and you may end up reading millions of records just to filter one or some of them -

from an Adabas point of view there is no difference, because ACCEPT / REJECT are Natural statements and are handled by Natural.

If you are really selecting by product code, then the example should read:

READ PRODUCT WITH PRODUCT-CODE = ‘1000’ THRU ‘1000’

END-READ

or just:
FIND PRODUCT WITH PRODUCT-CODE = ‘1000’

END-READ

This would avoid the problem Wolfgang alludes to (reading millions of records to filter a few of them) as Adabas would only return records with the desired product code.

1 Like