¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: COBOL in TK4-: Handling Signed Numbers


 

Mark et al,

This is probably what I recall.

I started on ICL 1900 cobol in about 1970, which only had DISPLAY and
COMPUTATIONAL fields. I then moved via ICL 2900 series which had COMP-3,
to IBM 370.

We did a lot of conversions from ICL to IBM, so for efficiency, we also
only used COMP-3 for calculations (of the appropriate length).

Chris
--
<cjar1950@...>



----------------------------------------------------------------------------------------------------------------------------------
On Wed, 06 Jan 2021 14:52:18 -0800
"Mark Waterbury" <mark.s.waterbury@...> wrote:
I could be mis-remembering ... the last time I did any COBOL programming professionally was in the 1970s ...

I think the problem with leaving it up to the compiler is that the compiler must do the implicit conversions to (temporary working storage) packed decimal in order to perform arithmetic, and then convert back to zoned decimal to store the results.?? This added a lot of overhead, especially on the early 360 and 370 models.? So, I was always taught to just allocate your own working storage variables with USAGE COMP-3 and move any fields into those variables, before performing any arithmetic operations, and then, when all done with the computations, convert the results back to zoned decimal, if that is what was needed or desired.

If you want to see what the compiler is generating, use the PMAP and DMAP compiler options.

Also, recall that with the S/360, it was real core memory, that was the most expensive component of most mainframe systems, and was a "scarce resource."? And DASD space was also not all that huge or available, and because packed decimal required only half the number of bytes to store numbers compared to zoned decimal, that was also usually the preferred method for long-term storage.? This was even true on magnetic tape.

So, it was normally only for use in punched cards or printouts where you had to convert to zoned decimal.

As far as I can recall ...




Join [email protected] to automatically receive all group messages.