There were already logical instructions as early as the 360 machine series.  
However, early COBOL compilers (and even up to Enterprise V4) implemented the 
COBOL standard for numeric values by converting unsigned binary values to 
packed decimal and zeroing out any integer digits left of 4 digits for unsigned 
9(4) COMP fields.  That "COBOL standards enforcement" code was slow because 
packed decimal instructions were significantly slower than binary ones on the 
early machines.

On much more recent z hardware the vector packed decimal instructions are 
significantly faster than the non-vector versions and newer compilers are 
taking advantage of those instructions.

HTH

-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On Behalf 
Of Schmitt, Michael
Sent: Thursday, June 16, 2022 10:36 AM
To: [email protected]
Subject: When did logical instructions appear?

My company's COBOL coding standards are* to define binary fields as signed 
(e.g. PIC S9(4) BINARY). I'm wondering why that's the standard.

The original standards were developed at least 40-60 years ago. They were 
revised in 1994 but the signed binary guidance remained.

One explanation could be if 50 years ago there were only signed binary 
instructions such as ADD, but not logical instructions such as ADD LOGICAL. Or 
maybe there were some logical instructions but not the full complement we have 
today.

Or it could be that whatever version of COBOL was used then (OS/VS COBOL or 
earlier) was more efficient with signed binary, such as due to the choices it 
made in instruction selection.

So my question is, roughly when did the machines get unsigned binary 
instructions for halfwords and fullwords?


* "are" isn't the right word here, since the COBOL coding conventions are no 
longer published anywhere. I only know what they are because I was on the team 
that reviewed the 1994 revision, and have a copy saved.

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Reply via email to