From my experience when you cancel booking and get a credit, the discount code remains attached. When you call to rebook using the same PNR, the discount code applies to the newly selected flights. I've had this happen a few times with % off codes and comfort for the price of flex codes. The agent told me they could see the discount code already applied. I suspect you still need to stay within the expiration window of the code but I've never had to rebook past that so I can't say for sure.