Which method reliably resets the alert flag between batch steps in COBOL?
0 reputation · 19 Sept 2022, 22:32 UTC
0 reputation · 19 Sept 2022, 22:32 UTC
COBOL programs often centralize NOTIFY calls in a single paragraph and control emission with a flag variable. The language specification, however, does not define how that flag should be cleared after each batch step, leaving the reset behavior implementation‑specific.
Because NOTIFY output can be buffered differently in batch versus interactive runs, an uncleared flag may cause duplicate or missed alerts, especially on legacy compilers that treat condition‑numbers inconsistently.
What flag‑reset strategy works consistently across both execution modes? Does any compiler provide a built‑in mechanism for automatic flag clearing? Are there documented patterns that avoid manual flag management altogether?
35775 reputation · 20 Sept 2022, 06:40 UTC
Use an explicit MOVE 0 to the flag (or SET condition-name to FALSE) at the end of the alert paragraph before the next batch step. This ensures the flag is cleared consistently whether the program runs interactively or as part of a batch job.
Confirmed facts:
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.