For Programmers: Free Programming Magazines  


Home > Archive > Cobol > August 2006 > Re: Code generated by various tests was Re: Prodcuing an output file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Code generated by various tests was Re: Prodcuing an output file
Arnold Trembley

2006-08-09, 9:55 pm



Clark F Morris wrote:
> This is a belated response to a previous posting and I am concerned
> about some of the code generated. If I were the systems programmer, I
> would be reporting a defect. My comments are interspersed below.
> (snip)
>


I apologize for dropping the correct attribution...


>
>
> Here I would expect a PACK, CP (compare packed) generation since
> negative zero is theoretically possible. If I were the systems
> programmer at the shop I would APAR the code.


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.

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.

With kindest regards,

--
http://arnold.trembley.home.att.net/

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com