GnuCOBOL state control break works

Baring a few small errors. So it reads one million customer records and creates a customer amount total by state. Some small errors. Here’s a few lines from the report.

I wrote a quick Python program to count states that I hard coded and can confirm that the customer counts match. I checked a few random states AK (the 1st state), AS (Not a valid US state but evidently in my zip code data base) so I may want to exclude non US states, and WY (the last state on the report).

Even though AS isn’t a valid state it would be easy to add up the amount fields for 20 records. The first record is obviously wrong and all those 20’s are probably ASCII spaces.

                    Customer Report (Sort: STATE, CITY)

                                               State      Customers                           Totals


                                                          2,020,202                     $2,020,202.02

                                                  AK          6,318                       $316,541.84

                                                  AL         19,935                     $1,006,592.05

                                                  AR         16,960                       $859,531.86

                                                  AS             20                         $1,076.16

                                                  AZ         12,628                       $639,201.20

                                                  CA         62,721                     $3,152,291.71

                                                  CO         15,792                       $797,474.28

                                                  CT         10,367                       $522,221.12

                                                  DC          6,401                       $325,323.06

                                                  DE          2,403                       $122,121.97

                                                  FL         35,138                     $1,774,823.82

                                                  GA         23,163                     $1,181,057.34

                                                  HI          3,479                       $175,622.14

                                                  IA         24,931                     $1,257,559.19

                                                  ID          7,727                       $385,406.22

                                                  IL         37,564                     $1,895,855.56

I’m marveling how fast the COBOL program runs. But even my simple Python program is fast, of course it’s not also sorting. Here I ran it to count CA. You can see the total matches the report and even this program, processed the file in less than half a second.

(env) bill@bill-MS-7B79:python readCust.py"
62721 state matches
1000000 lines read

real    0m0.373s
user    0m0.350s
sys     0m0.024s
(env) bill@bill-MS-7B79:~/MyStuff/COBOL/progs/Sort06$

The tools available today are amazing. Back in school, I was punching out COBOL programs on cards.