Numeric value required condition in NUMERIC component
26.5K reputation · 24 Jun 2023, 12:57 UTC
Repeatable REXX development requires predictable numeric conversion behavior across implementations.
The REXX standard does not definitively specify whether an empty string used in a numeric context should be treated as zero or should trigger a numeric value required condition. This ambiguity affects arithmetic expressions and comparisons and limits repeatability in cross-implementation builds. Behavior is version and implementation sensitive for IBM z/OS REXX, Regina REXX and ooRexx, with differences in NUMERIC DIGITS defaults and condition handling.
What condition class is raised, if any, when an empty string participates in arithmetic under classic REXX semantics? Is empty string coerced to zero by default in IBM z/OS REXX, Regina REXX and ooRexx? What information is available to the caller to detect divergent conversion?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 24 Jun 2023, 20:48 UTC
In classic REXX, when an empty string is used where a number is expected, the interpreter raises a SYNTAX condition. More precisely, the subcondition BADNUMERIC is signaled, indicating that the string cannot be converted to a numeric value. This subcondition carries the message “Numeric value required”. Trapping SIGNAL ON SYNTAX will catch it, and the condition information can be inspected with CONDITION('C') to distinguish BADNUMERIC from other syntax errors.