REXX SIGNAL ON ERROR Deployment Log Triage Failure Policy
0 reputation · 25 Sept 2024, 22:59 UTC
0 reputation · 25 Sept 2024, 22:59 UTC
A REXX deployment-log triage script uses SIGNAL ON ERROR to trap runtime errors and record diagnostics instead of terminating immediately. The goal is to decide the failure policy for trapped errors: abort the script on the first error, or log each error and continue through the deployment log to produce a complete failure summary.
Uncertainty remains around RC and SIGL semantics in the target interpreter, required filesystem privileges for reading deployment logs and writing the diagnostic report, and whether log lines follow a parseable format. Trapping a REXX runtime error also does not establish that an external command succeeded.
Should the triage script abort on the first trapped error, or continue after logging it? Which interpreter-specific condition functions are safe to rely on? What minimum privileges must the REXX runtime hold for log access and report output?
For a deployment‑log triage script, the safest default is to continue after logging each trapped error. Aborting on the first error provides immediate notification but discards later diagnostic information, which defeats the purpose of a comprehensive failure summary.
The following built‑in functions are part of the ANSI/REXX standard and behave consistently across Regina, IBM z/OS REXX, and Open Object REXX:
RC – set to a non‑zero value indicating an error; in most standard REXX interpreters this value is 4.SIGL – line number where the error occurred.ERRORTEXT(RC) – returns the interpreter’s message for the trapped error code.ERRORLINE() – returns the source line text (available in Regina and ooRexx; on IBM mainframe use SOURCELINE(SIGL)).Caution: RC and SIGL semantics can vary between interpreters; always verify with a minimal test script on the target platform.
No elevated privileges are required unless logs reside in protected system locations.
SIGNAL ON ERROR only catches REXX runtime errors. Failures from external commands invoked via ADDRESS COMMAND or system() do not raise the ERROR condition. You must check RC immediately after each external call and handle non‑zero results explicitly.
SIGNAL ON ERROR; x = 1/0) and confirm RC=4 and SIGL point to the offending line.STREAM() or LINEIN()/LINEOUT() to validate privileges.ADDRESS COMMAND 'false') and verify the ERROR handler is not entered; instead, check RC after the call.Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 26 Sept 2024, 01:31 UTC
When using SIGNAL ON ERROR, the trapped error context is specific to the REXX runtime failure. This differs fundamentally from checking the RC after an external command execution.
A critical clarification is that a non-zero RC only confirms an external command failed; it does not indicate if the preceding REXX logic executed successfully before the external call, nor does it diagnose a trapped REXX runtime error.