| Clark F Morris 2006-08-10, 6:55 pm |
| All of this discussion is about IBM z series (360/370/390) COBOL and
may be applicable logic wise although not code generation wise to the
i series (AS400) COBOL.
On Thu, 10 Aug 2006 03:27:25 GMT, Arnold Trembley
<arnold.trembley@worldnet.att.net> wrote:
>
>
>Clark F Morris wrote:
>
>I apologize for dropping the correct attribution...
>
>
>
>Bill Klein might want to comment on this, but I believe this is an
>artifact of a philosophical change by IBM in their generated code,
>which started to creep in around the time of COBOL II. All the
>Language Environment enabled COBOL compilers behave this way.
>
>Their thinking seems to be that a CP (Compare Packed) instruction is
>much less efficient than a CLC (Compare Logical Character). Therefore
>they try to enforce correct signs on packed decimal numbers so they
>can be compared with a faster CLC instruction rather than a slower CP
>instruction. The CLC is a runtime optimization IBM has chosen.
The CP is probably less efficient. Also they may be generating code
differently for NUMPROC(MIG). I tend to shy away from NUMPROC(NOPFD)
because it masks problems. I would rather deal with specific problem
causing values such as spaces being equivalent to zeros (also
low-values) while failing the really bad ones. Also NOPFD definitely
causes more code to be generated. For the NUMPROC(PFD) option the CLC
should be valid for all values in packed fields with the possible
exception of zero. The reason is that I recall there are cases
described in the Principles of Operations that a negative zero can be
created.
>
>I tend to prefer using the NUMPROC(NOPFD) compiler option because it
>performs more sign fixups. I have actually seen the same program
>abend with S0C7 and recompiling it from NUMPROC(MIG) to NUMPROC(NOPFD)
>corrected the problem.
>
>In the actual example, a negative zero should be illegal, and it
>should fail a NUMERIC class test.
It should for the unsigned field but not for the signed fields. The
fun with NUMPROC(PFD) comes in dealing with data that can be
manipulated with by CSP, Visual Gen and possibly other products where
F zones / signs are forced for positive numbers. Code generated using
NUMPROC(MIG) handles this and treats the field with these values as
numeric. Code generated with NUMPROC(PFD) treats these values as NOT
NUMERIC.
>
>With kindest regards,
|