It looks like you might have an extra "and" at the end. I think these are your last 2 lines of code.
cnfndtyp ne 'S/L' and; if put(contid,$accptd.) ne 'ACCEPTED';