In 1981, I don't know the complier level I wrote a Cobol loop to distribute the small arithmetic error across a set of variables. I don't remember the algorithm, but I wrote it to loop until the remaining error was zero. The routine looped when the error value stabilized on negative packed zero. H'0000000D' which was not = ZERO in that Cobol. I coded such tests a <= ZERO ever since.
Machine might have been Amdahl > -----Original Message----- > From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On > Behalf Of Paul Gilmartin > Sent: Monday, April 28, 2025 6:35 PM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: Packed decimal sign nibbles > > On Mon, 28 Apr 2025 16:32:40 +0000, Schmitt, Michael wrote: > > > ... > >C: positive > >D: negative > >F: unsigned > > > >If all your code has preferred signs then it can generate more efficient > >code, > by using CLC and MVC for example instead of packed decimal instructions. > > > An "unsigned" sign is an oxymoron. > > In C, if an integral type is declared unsigned, all bits of such an object > represent > the magnitude, none a sign. Packed decimal provides no such economy of > storage. But since all digits are in the range 0-9 and signs in A-F, the > final > nybble could be used in the magnitude of an unsigned number with no > ambiguity. > > Even as IBM, wisely IMO, chose twos complement representation for fixed > point objects, they could have used tens complement for packed decimal. > That would have provided a greater magnitude range and avoided the need > for a recomplement pass when the operand complemented turned out to > have the greater magnitude, which can not be recognized until the addition is > complete. > > FORTRAN on the IBM 7* and some CDC computers read blank input fields as > "-0". no such representation is available on s/360. > This was regarded as a limitation by programmers who no longer had a way to > detect omitted data. > > -- > gil > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, send email to > lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN