Blog Archive

Monday, May 15, 2023

05-14-2023-1942 - Electronic data processing (EDP), etc. (draft)

Electronic data processing (EDP) can refer to the use of automated methods to process commercial data. Typically, this uses relatively simple, repetitive activities to process large volumes of similar information. For example: stock updates applied to an inventory, banking transactions applied to account and customer master files, booking and ticketing transactions to an airline's reservation system, billing for utility services. The modifier "electronic" or "automatic" was used with "data processing" (DP), especially c. 1960, to distinguish human clerical data processing from that done by computer.[1][2] 

https://en.wikipedia.org/wiki/Electronic_data_processing

A punched card (also punch card[1] or punched-card[2]) is a piece of stiff paper that holds digital data represented by the presence or absence of holes in predefined positions. Punched cards were once common in data processing applications or to directly control automated machinery.

Punched cards were widely used through much of the 20th century in the data processing industry, where specialized and increasingly complex unit record machines, organized into semiautomatic data processing systems, used punched cards for data input, output, and storage.[3][4] The IBM 12-row/80-column punched card format came to dominate the industry. Many early digital computers used punched cards as the primary medium for input of both computer programs and data.

While punched cards are now obsolete as a storage medium, as of 2012, some voting machines still used punched cards to record votes.[5] Punched cards also had a significant cultural impact. 

https://en.wikipedia.org/wiki/Punched_card

In computing, a signed overpunch is a coding scheme which stores the sign of a number by changing (usually) the last digit. It is used in character data on IBM mainframes by languages such as COBOL, PL/I, and RPG.[1] Its purpose is to save a character that would otherwise be used by the sign digit.[2] The code is derived from the Hollerith Punched Card Code, where both a digit and a sign can be entered in the same card column. It is called an overpunch because the digit in that column has a 12-punch or an 11-punch above it to indicate the sign. The top three rows of the card are called zone punches,[3] and so numeric character data which may contain overpunches is called zoned decimal.

In IBM terminology, the low-order four bits of a byte in storage are called the digit, and the high-order four bits are the zone.[4] The digit bits contain the numeric value 0–9. The zone bits contain either 'F'x, forming the characters 0–9, or the character position containing the overpunch contains a hexadecimal value indicating a positive or negative value, forming a different set of characters. (A, C, E, and F zones indicate positive values, B and D negative).

The PACK instruction on IBM System/360 architecture machines converts the sign of a zoned decimal number when converting to packed decimal, and the corresponding UNPK instruction will set the correct overpunched sign of its zoned decimal output.[5] 

https://en.wikipedia.org/wiki/Signed_overpunch

Packed BCD

In packed BCD (or simply packed decimal[38]), each nibble represent a decimal digit.[nb 8] Packed BCD has been in use since at least the 1960s and is implemented in all IBM mainframe hardware since then. Most implementations are big endian, i.e. with the more significant digit in the upper half of each byte, and with the leftmost byte (residing at the lowest memory address) containing the most significant digits of the packed decimal value. The lower nibble of the rightmost byte is usually used as the sign flag, although some unsigned representations lack a sign flag. As an example, a 4-byte value consists of 8 nibbles, wherein the upper 7 nibbles store the digits of a 7-digit decimal value, and the lowest nibble indicates the sign of the decimal integer value.

Standard sign values are 1100 (hex C) for positive (+) and 1101 (D) for negative (−). This convention comes from the zone field for EBCDIC characters and the signed overpunch representation. Other allowed signs are 1010 (A) and 1110 (E) for positive and 1011 (B) for negative. IBM System/360 processors will use the 1010 (A) and 1011 (B) signs if the A bit is set in the PSW, for the ASCII-8 standard that never passed. Most implementations also provide unsigned BCD values with a sign nibble of 1111 (F).[39][40][41] ILE RPG uses 1111 (F) for positive and 1101 (D) for negative.[42] These match the EBCDIC zone for digits without a sign overpunch. In packed BCD, the number 127 is represented by 0001 0010 0111 1100 (127C) and −127 is represented by 0001 0010 0111 1101 (127D). Burroughs systems used 1101 (D) for negative, and any other value is considered a positive sign value (the processors will normalize a positive sign to 1100 (C)).

Sign
digit
BCD
8 4 2 1
Sign Notes
A 1 0 1 0 +  
B 1 0 1 1  
C 1 1 0 0 + Preferred
D 1 1 0 1 Preferred
E 1 1 1 0 +  
F 1 1 1 1 + Unsigned

No matter how many bytes wide a word is, there is always an even number of nibbles because each byte has two of them. Therefore, a word of n bytes can contain up to (2n)−1 decimal digits, which is always an odd number of digits. A decimal number with d digits requires 1/2(d+1) bytes of storage space.

For example, a 4-byte (32-bit) word can hold seven decimal digits plus a sign and can represent values ranging from ±9,999,999. Thus the number −1,234,567 is 7 digits wide and is encoded as:

0001 0010 0011 0100 0101 0110 0111 1101
1    2    3    4    5    6    7    −

Like character strings, the first byte of the packed decimal – that with the most significant two digits – is usually stored in the lowest address in memory, independent of the endianness of the machine.

In contrast, a 4-byte binary two's complement integer can represent values from −2,147,483,648 to +2,147,483,647.

While packed BCD does not make optimal use of storage (using about 20% more memory than binary notation to store the same numbers), conversion to ASCII, EBCDIC, or the various encodings of Unicode is made trivial, as no arithmetic operations are required. The extra storage requirements are usually offset by the need for the accuracy and compatibility with calculator or hand calculation that fixed-point decimal arithmetic provides. Denser packings of BCD exist which avoid the storage penalty and also need no arithmetic operations for common conversions.

Packed BCD is supported in the COBOL programming language as the "COMPUTATIONAL-3" (an IBM extension adopted by many other compiler vendors) or "PACKED-DECIMAL" (part of the 1985 COBOL standard) data type. It is supported in PL/I as "FIXED DECIMAL". Beside the IBM System/360 and later compatible mainframes, packed BCD is implemented in the native instruction set of the original VAX processors from Digital Equipment Corporation and some models of the SDS Sigma series mainframes, and is the native format for the Burroughs Corporation Medium Systems line of mainframes (descended from the 1950s Electrodata 200 series).

Ten's complement representations for negative numbers offer an alternative approach to encoding the sign of packed (and other) BCD numbers. In this case, positive numbers always have a most significant digit between 0 and 4 (inclusive), while negative numbers are represented by the 10's complement of the corresponding positive number. As a result, this system allows for 32-bit packed BCD numbers to range from −50,000,000 to +49,999,999, and −1 is represented as 99999999. (As with two's complement binary numbers, the range is not symmetric about zero.)

Fixed-point packed decimal

Fixed-point decimal numbers are supported by some programming languages (such as COBOL and PL/I). These languages allow the programmer to specify an implicit decimal point in front of one of the digits. For example, a packed decimal value encoded with the bytes 12 34 56 7C represents the fixed-point value +1,234.567 when the implied decimal point is located between the fourth and fifth digits:

12 34 56 7C
12 34.56 7+

The decimal point is not actually stored in memory, as the packed BCD storage format does not provide for it. Its location is simply known to the compiler, and the generated code acts accordingly for the various arithmetic operations.

Higher-density encodings

If a decimal digit requires four bits, then three decimal digits require 12 bits. However, since 210 (1,024) is greater than 103 (1,000), if three decimal digits are encoded together, only 10 bits are needed. Two such encodings are Chen–Ho encoding and densely packed decimal (DPD). The latter has the advantage that subsets of the encoding encode two digits in the optimal seven bits and one digit in four bits, as in regular BCD.

Zoned decimal

Some implementations, for example IBM mainframe systems, support zoned decimal numeric representations. Each decimal digit is stored in one byte, with the lower four bits encoding the digit in BCD form. The upper four bits, called the "zone" bits, are usually set to a fixed value so that the byte holds a character value corresponding to the digit. EBCDIC systems use a zone value of 1111 (hex F); this yields bytes in the range F0 to F9 (hex), which are the EBCDIC codes for the characters "0" through "9". Similarly, ASCII systems use a zone value of 0011 (hex 3), giving character codes 30 to 39 (hex).

For signed zoned decimal values, the rightmost (least significant) zone nibble holds the sign digit, which is the same set of values that are used for signed packed decimal numbers (see above). Thus a zoned decimal value encoded as the hex bytes F1 F2 D3 represents the signed decimal value −123:

F1 F2 D3
1  2 −3

EBCDIC zoned decimal conversion table

BCD digit Hexadecimal EBCDIC character
0+ C0 A0 E0 F0 { (*)   \ (*) 0
1+ C1 A1 E1 F1 A ~ (*)   1
2+ C2 A2 E2 F2 B s S 2
3+ C3 A3 E3 F3 C t T 3
4+ C4 A4 E4 F4 D u U 4
5+ C5 A5 E5 F5 E v V 5
6+ C6 A6 E6 F6 F w W 6
7+ C7 A7 E7 F7 G x X 7
8+ C8 A8 E8 F8 H y Y 8
9+ C9 A9 E9 F9 I z Z 9
0− D0 B0     }  (*) ^  (*)    
1− D1 B1     J      
2− D2 B2     K      
3− D3 B3     L      
4− D4 B4     M      
5− D5 B5     N      
6− D6 B6     O      
7− D7 B7     P      
8− D8 B8     Q      
9− D9 B9     R      

(*) Note: These characters vary depending on the local character code page setting.

Fixed-point zoned decimal

Some languages (such as COBOL and PL/I) directly support fixed-point zoned decimal values, assigning an implicit decimal point at some location between the decimal digits of a number. For example, given a six-byte signed zoned decimal value with an implied decimal point to the right of the fourth digit, the hex bytes F1 F2 F7 F9 F5 C0 represent the value +1,279.50:

F1 F2 F7 F9 F5 C0
1  2  7  9. 5 +0

https://en.wikipedia.org/wiki/Binary-coded_decimal#Packed_BCD

Diamond[a] is one of the best-known and most sought-after gemstones. They have been used as decorative items since ancient times. 

https://en.wikipedia.org/wiki/Diamond_(gemstone)

https://en.wikipedia.org/wiki/Blood_diamond


 

No comments:

Post a Comment