Validating numeric fields in cobol a thoughtful dating service for christian single
These days, CPU cycles are cheap, man-hours are expensive.The comment about using 88-levels isn't quite correct.I have found this problem occurs most often with data received from outside sources: customers and vendors. For example, a field defined as “5s 0” should contain a number in the range of -99999 to 99999.Many times this data comes from systems other than a System i. The data is invalid if it contains values such as ABCDE or 123A6.Identifying Errors How do we identify invalid data? If a byte contains the hex value C1 (the letter “A”) it would be valid for any alphanumeric field, but may be valid or invalid for part of a numeric field, depending on the position of the value and the definition of the field.In order to determine validity you need to know the field definitions for a file and the hex representation of the data. The source consists of five members: As you can see I’ve chose to use REXX for some of the steps as it has functions that easily convert data from character to hex.The hex representation of the zoned-decimal value 123 stored in a “5s 0” field is: F0F0F1F2F3 or F0F0F1F2C3. Normally packed fields have an odd length, such as “7p 0” or “9p 2”.
Also, if two or more values are being test that lead to the same thing to be done, I put each WHEN on a line by itself. The Grace Hopper story about the length of wire is often misconstrued that she was interested in efficiency. How do you interrogate a field using EVALUATE with level 88s in the input record? Could you enlighten on which one is faster and under what type of conditions.
Values for each zone and digit can range from 0 to 9 and A to F for the values 0 to 15 in the base-16 (hexadecimal).
The base-10 (decimal) numbers 0 to 9 are defined for zoned-decimal fields in hex as F0-F9, respectively. For this byte only, the zone portion can be either a C or F for positive values and a D for negative.
For example, a “7p 2” field is stored in (7 1) / 2 = 4 bytes.
For packed fields each zone and digit contains a position of the value except for the right-most digit which contains the sign.