convert alphanumeric to numeric
data definitions required
convert-this w 5 a
convert-this-num convert-this 5 n 0
convert-this-byte convert-this 1 a occurs 5 index ctb-x
this-packed w 3 p 0
error-flag 1 1 a
procedure is
error-flag = 'x'
ctb-x = 0
do-while ctb-c < 5
case convert-this-byte
value numeric
error-flag = error-flag
*or any other null action
value ' '
convert-this-byte = '0'
* if there are valid characters that need to be converted - test for them and convert them, in my day it was spaces to the left convert to zero blindly
otherwiese
error-flag = 'y'
end-case
ctb-x = ctb-x + 1
end-do
if error-flag = 'y'
*define an error routine and execute it
else
this-packed = convert-this-num
* move the field to the resulting packed field "this-packed"
end-if
As IRA used 8 bits per character . IRA characters are compatible with packed decimal .
Packed decimal is a method used in computing to store more in less space. A bit of theory here. Characters are stored in binary in their ASCII representation, such that the number 1 = ascii 49 (decimal). Packed decimal means you can store two numbers (numbers only) in the same space, so that ascii 49 = numbers 4 and 9. There is overhead so it is always a trade off between space and computing. And storage is cheap these days
In Cobol, they had a serious concern for memory size. So they came up with a method known as BCD (Binary Coded Decimal), where a decimal value was converted to binary to save space. Check this link out. It will break down the details.
BCD:A byte (unpacked) representation of a decimal digit in the range0 through9. Unpacked decimal numbers are stored as unsigned byte quantities. Onedigit is stored in each byte. The magnitude of the number is determined fromthe low-order half-byte; hexadecimal values 0-9 are valid and areinterpreted as decimal numbers. The high-order half-byte must be zero formultiplication and division; it may contain any value for addition andsubtraction.Packed BCD:A byte (packed) representation of two decimal digits, each in the range0 through 9. One digit is stored in each half-byte. The digit in thehigh-order half-byte is the most significant. Values 0-9 are valid in eachhalf-byte. The range of a packed decimal byte is 0-99.
"Packed quickly" is a phrase consisting of an adverb ("quickly") and a verb ("packed"). The verb in this phrase is "packed," which describes the action being performed.
why plahile material packed
The 8087 Math CoProcessor can work with two data formats: temporary real and packed decimal. Each data instruction, whether real or decimal, can be up to 80 bits long.
Yes it is always packed
it is packed 900 demerios
Action Packed was created in 1988.
A homophone for "packed" is "packed." Both words are spelled and pronounced the same but have different meanings.
a packed sphere of snow is called a 'snowball"