Validating numeric fields in cobol suffolk dating group
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.
The first four bits of each byte are called the “zone” and the last four bits the “digit”.Any phrase that will evaluate to true or false at execution time is acceptable, so the following should work just fine: EVALUATE TRUE .... The computer doesn't care - whatever is most likely to increase comprehension by someone performing maintenance months or years down the road is all that's important.The same goes for ordering the WHENs by probability - it may be important in a batch-style application where thousands or millions of comparisons are done or a real-time app when you might have to wring out every last drop of efficiency, but if not, keep them in a logical order that helps others comprehend what's going on.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.004430 I would have to disagree with the poster regarding 88-levels in an EVALUATE. For anything more complex, indentation similar to that described already is the way to go.