Bob,
You should go back and read all of Dave's posts and and the responses.
This has all been discussed down to the "jot and tittle". Including the
fact that Dave is on z/VSE, not z/OS.
Tony Thigpen
Bob Raicer wrote on 2/18/22 20:05:
Dave --
I'm not clear on what you mean by "precision" and "scale" when you
say:
"transform a zoned-decimal number with up to 31 digits of precision
and up to 15 digits for scale with an external sign and an explicit
decimal point into a packed number that is properly aligned."
Do you mean "precision" in the same sense as the definition
contained in the Rexx documentation included below?
Does "scale" mean a scaling factor in the sense of how COBOL defines
it with the "P" character in a PICTURE string? That is, each "P"
character in the PICTURE string represents a power of 10 (negative
or positive, depending upon where the "P" characters appears in the
PICTURE string relative to the "9"s in the string) which is to be
used as a multiplier on the actual value. For example, PICTURE
999ppp means the actual area in storage for this data item is only
large enough to store three decimal digits, but the value is to be
interpreted as being multiplied by 10**3. So a value of "123" is to
be interpreted as "123000" when used in, for example, arithmetic
operations.
Perhaps you intend to mean "scale" as the number of decimal digits
to the right of an explicitly specified decimal point, where you
intend to support up to 15 such digits.
I also don't understand where (or how) implied decimal points are
specified in your conversion and representation scheme.
For what it's worth, why don't you do all (or the majority) of your
decimal string validation and manipulation stuff in Rexx? You're
already writing Rexx code and doing this in Rexx itself is way
easier and, overall, more robust.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
. Open Object Rexx Reference
. V4.2 (2014-01-10)
.
. 10.1. Precision
.
. Precision is the maximum number of significant digits that can
. result from an operation. This is controlled by the instruction:
.
. >>-NUMERIC DIGITS--+------------+--;---------------------------><
. +-expression-+
.
. The expression is evaluated and must result in a positive whole
. number. This defines the precision (number of significant digits)
. of a calculation. Results are rounded to that precision, if
. necessary.
.
. If you do not specify expression in this instruction, or if no
. NUMERIC DIGITS instruction has been processed since the start of a
. program, the default precision is used. The Rexx standard for the
. default precision is 9.
.
. NUMERIC DIGITS can set values smaller than nine. However, use
. small values with care because the loss of precision and rounding
. affects all Rexx computations, including, for example, the
. computation of new values for the control variable in DO loops.
.
.
. NUMERIC DIGITS
.
. Controls the precision to which arithmetic operations and built-in
. functions are evaluated. If you omit expression1, the precision
. defaults to 9 digits.
.
. There is no limit to the value for DIGITS (except the amount of
. storage available), but high precisions are likely to require a
. great amount of processing time. It is recommended that you use
. the default value whenever possible
.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
.
. z/OS Version 2 Release 4 TSO/E REXX Reference (SA32-0972-40)
.
. Precision
.
. Precision is the maximum number of significant digits that can
. result from an operation. This is controlled by the instruction:
.
.
. >>-NUMERIC DIGITS--+------------+--;---------------------------><
. +-expression-+
.
. The expression is evaluated and must result in a positive whole
. number. This defines the precision (number of significant digits)
. to which calculations are carried out. Results are rounded to
. that precision, if necessary.
.
. If you do not specify expression in this instruction, or if no
. NUMERIC DIGITS instruction has been processed since the start of a
. program, the default precision is used. The REXX standard for the
. default precision is 9.
.
. Note that NUMERIC DIGITS can set values below the default of nine.
. However, use small values with care - the loss of precision and
. rounding thus requested affects all REXX computations, including,
. for example, the computation of new values for the control
. variable in DO loops.
.
.
. NUMERIC DIGITS
.
. Controls the precision to which arithmetic operations and
. arithmetic built-in functions are evaluated. If you omit
. expression1, the precision defaults to 9 digits.
.
. There is no limit to the value for DIGITS (except the amount of
. storage available), but note that high precisions are likely to
. require a good deal of processing time. It is suggested that you
. use the default value wherever possible
.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::