thanks for query.
From your long history it is confirmed that you are having gastric ulcer.
Passing black color stool indicates that you are having active bleeding from ulcer but passing frank blood indicates that that there is bleeding from lower intestinal tract suggesting that you might be having bleeding pile or fissure in ano
So i advice you to consult Gastro Enterologist and get examined.
Ok and bye.