The purpose of this study is to evaluate the efficacy of TAK-438, once daily (QD), compared to AG-1749 (Lansoprazole) in patients with a history of gastric or duodenal ulcer who require long-term therapy of non-steroidal anti-Inflammatory drug (NSAID).