Validating numeric fields in cobol encounters times online dating

Posted by / 19-Jan-2020 18:39

I tried to illustrate it here by an example, but this software wouldn't take leading spaces, so I couldn't get it to indent properly. The story was an anecdote about the speed of computers not the efficency of code. Since this has sort of gone to the wayside because of the speed of computers some of the newer programmers like myself are not sure which is faster during runtime.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.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.

You can't use 88-levels in a WHEN statement unless you're saying something like EVALUATE TRUE WHEN LIFE. The EVALUATE VALUE(1:6) worked fine for me, except I added single quotes around the 1 and the 2. 004310 004320 EVALUATE PLANET-NUMBER 004330 WHEN 1 MOVE "Mercury" TO PLANET-NAME 004340 WHEN 2 MOVE "Venus " TO PLANET-NAME 004350 WHEN 3 MOVE "Earth " TO PLANET-NAME 004360 WHEN 4 MOVE "Mars " TO PLANET-NAME 004370 WHEN 5 MOVE "Jupiter" TO PLANET-NAME 004380 WHEN 6 MOVE "Saturn " TO PLANET-NAME 004390 WHEN 7 MOVE "Uranus " TO PLANET-NAME 004400 WHEN 8 MOVE "Neptune" TO PLANET-NAME 004410 WHEN 9 MOVE "Pluto " TO PLANET-NAME 004420 WHEN OTHER MOVE " " TO PLANET-NAME 004430 END-EVALUATE.004440 004310 004320 EVALUATE PLANET-NAME 004330 WHEN "Mercury" MOVE 1 TO PLANET-NUMBER 004340 WHEN "Venus " MOVE 2 TO PLANET-NUMBER 004350 WHEN "Earth " MOVE 3 TO PLANET-NUMBER 004360 WHEN "Mars " MOVE 4 TO PLANET-NUMBER 004370 WHEN "Jupiter" MOVE 5 TO PLANET-NUMBER 004380 WHEN "Saturn " MOVE 6 TO PLANET-NUMBER 004390 WHEN "Uranus " MOVE 7 TO PLANET-NUMBER 004400 WHEN "Neptune" MOVE 8 TO PLANET-NUMBER 004410 WHEN "Pluto " MOVE 9 TO PLANET-NUMBER 004420 WHEN OTHER MOVE 0 TO PLANET-NUMBER 004420 END-EVALUATE.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.

validating numeric fields in cobol-88validating numeric fields in cobol-20validating numeric fields in cobol-72

004430 004310 004320 EVALUATE TRUE 004330 WHEN PLANET-NAME = "Mercury" MOVE 1 TO PLANET-NUMBER 004340 WHEN PLANET-NAME = "Venus " MOVE 2 TO PLANET-NUMBER 004350 WHEN PLANET-NAME = "Earth " MOVE 3 TO PLANET-NUMBER 004360 WHEN PLANET-NAME = "Mars " MOVE 4 TO PLANET-NUMBER 004370 WHEN PLANET-NAME = "Jupiter" MOVE 5 TO PLANET-NUMBER 004380 WHEN PLANET-NAME = "Saturn " MOVE 6 TO PLANET-NUMBER 004390 WHEN PLANET-NAME = "Uranus " MOVE 7 TO PLANET-NUMBER 004400 WHEN PLANET-NAME = "Neptune" MOVE 8 TO PLANET-NUMBER 004410 WHEN PLANET-NAME = "Pluto " MOVE 9 TO PLANET-NUMBER 004420 WHEN OTHER MOVE 0 TO PLANET-NUMBER 004420 END-EVALUATE. WHEN OTHER PERFORM UNKNOWN-CLAIM-TYPE END-EVALUATE As far as indentation, etc are concerned, I would actually write it as above if it were a fairly simple case-structure like this with a single action to be taken in each case.