Need to send an Email with coupon code. If a subscribe has received coupon code before send the same code or if did not receive code claim a new coupon code from other Data extension. The below ampscript I wrote which gives an error.
%%[SET @code=Lookup('Jan_Newsletter_USD','secret_word','SubscriberKey',_subscriberkey)
IF EMPTY(@code) THEN
SET @code=Lookup('Jan_Newsletter_CAD','secret_word','SubscriberKey',_subscriberkey)
ELSE
SET @VoucherRow = ClaimRow('Feb_Newsletter_USD', 'IsClaimed','JobID', JobID, 'ListID', listid, 'BatchID', _JobSubscriberBatchID, 'SubscriberKey', _subscriberkey,'IncrementID', 1)
ELSEIF EMPTY(@VoucherRow) Then
RaiseError('No valid voucher codes', true)
ELSIF
SET @code = field(@VoucherRow, 'secret_word')
ENDIF
ENDIF]%%