CNV BIN Statement
Overview
o UNICODE Alpha Field from Numeric field or NATIONAL Alpha Field from Numeric Field
- Converts the value of the specified Numeric Field to a 4-byte unsigned binary integer and stores it in the 1- character (4-byte) Unicode/National Alpha field.
- The UNICODE/NATIONAL Alpha Field must be defined as a 1 character (4-byte internal length) field.
- Em build should fail if the character length of the UNICODE/NATIONAL Alpha Field is greater than 1 character.
- An Overflow error should occur at runtime if the value of the Numeric Field is greater than the maximum value that can be stored in a 4-byte unsigned binary integer.
- An Overflow error should occur at runtime if the value of the Numeric Field is negative.
o UNICODE Alpha Field from Literal Value or NATIONAL Alpha Field from Literal Value
- Converts a numeric literal value to a 4-byte unsigned binary integer and stores it in the 1- character (4-byte) UNICODE/NATIONAL Alpha field.
- The UNICODE/NATIONAL Alpha Field must be defined as a 1 character (4-byte internal length) field.
- The numeric literal value must be a positive decimal value.
- Em build should fail if the numeric literal value is negative.
- Em build should fail if the character length of the UNICODE/NATIONAL Alpha Field is greater than 1 character.
- An Overflow error should occur at runtime if the value of the Numeric Literal is greater than the maximum value that can be stored in a 4-byte unsigned binary integer. (Maybe this should be an Em build error instead)
o UNICODE Alpha Field to Numeric Field or NATIONAL Alpha Field to Numeric Field
- Converts a 4-byte unsigned binary integer value that is stored in a 1-character (4-byte internal length) UNICODE/NATIONAL Alpha Field to an equivalent value stored in the specified Numeric Field.
- The UNICODE/NATIONAL Alpha Field must be defined as a 1 character (4-byte internal length) field.
- Em build should fail if the character length of the UNICODE/NATIONAL Alpha Field is greater than 1 character.
- An Overflow error should occur at runtime if the value of the 4-byte unsigned binary integer is greater than the maximum value that can be stored in the specified Numeric Field.
Test Plan
- convert valid numeric field unicode value to alpha/national and alpha/unicode
- try to CNV BIN from numeric field into alpha/national and alpha/unicode that are not 1 character (Em build error)
- try to CNV BIN from numeric field into alpha/national and alpha/unicode from invalid numerics (negative, >=4294967296)
- convert valid literal unicode value to alpha/national and alpha/unicode
- try to CNV BIN from literal into alpha/national and alpha/unicode that are not 1 character (Em build error)
- try to CNV BIN from literal into alpha/national and alpha/unicode from invalid numerics (negative, >=4294967296)
- try to CNV BIN from unicode/national to numeric field
- try to CNV BIN from unicode/national field >1 character to numeric field
- try to CNV BIN from unicode/national to numeric field of insufficient size
BUGS
- Painted 1 character national field on image, displayed as 4 characters. unicode was ok. * FIXED * March 28 engine
- CNV BIN from negative literal does not generate compile time error, generates 'Invalid Sign' runtime error. Might not be actual bug, just different implementation? Confirmed 4/2/11, designed this way
- National fields are not transcoded to their proper character set. I can CNV BIN a character from the Unicode character set (but that does not exist in the National character set as specified on the SYSPARM file) into a National field, and it will display the Unicode character. Instead, it should transcode the Unicode character to the National character, and display that. ** Not a bug FAD**
- Overflow errors are not occurring at the expected limit. The max value for a 4 byte unsigned number is 4294967295, if I use this value I get overflow errors. If I decrease that by 1 to 4294967294, I do not get an overflow. * FIXED * June 9 engine
- Uses wrong character set? Example, I use CNV BIN to put 0xA4 into TEMP 1. This is a spiky ball character, but the debugger shows that TEMP 1 contains a Euro symbol. ** I think the problem is that my reference table only has the 8859-1 character set, where A4 is the spiky ball, but Appx is using 8859-15, where the same binary value is the Euro symbol. **
--
JeanNeron - 2011-03-11