Aim — to improve the diagnosis and assessment of the severity of postoperative functional gastrostasis, as well as to study correlation with preoperative gastrointestinal motility, disturbances of gastric evacuation, homeostasis, age of patients and certain somatic diseases. Material and methods. There were 45 patients with ulcerative stenosis. Duodenoplasty combined with highly selective vagotomy was performed in all patients. Evaluation of the motor function of the stomach was carried out by peripheral electrogastroenterogram (PEGEG). Results. Patients were divided into those with compensated and decompensated gastric motility on the basis of preoperative PEGEG parameters. Postoperative functional gastrostasis was diagnosed in 24 (53.3%) patients with initially decompensated gastric motility. We have developed a computer program DiaGastro: Gastrostasis for the automatic diagnosis of gastrostasis and determining its severity in this group of patients according to PEGEG data with an accuracy of 93%. It was observed a strong correlation of preoperative decompensation of gastric motility grade II and III and decompensation of homeostasis with the development of gastrostasis. Age over 60 years was a significant predictor of postoperative gastrostasis. Patients with diabetes mellitus type II and those with combination of cardiovascular and respiratory diseases had advanced risk of postoperative gastrostasis. Conclusion. PEGEG is able to diagnose gastrostasis and to assess its severity. Independent risk factors of gastrostasis are preoperative decompensation of gastric motility, decompensated evacuation function of the stomach grade II and III, decompensation of homeostasis, advanced (over 60) age, diabetes mellitus type II, and combination of cardiovascular and respiratory diseases.