COBOL Array Manipulation

COBOL features are inherent that perform array manipulations quire efficiently. Typically you use integer variables as indices. Then the Perform Varying with the after option is used to iterate through the array. COBOL features are inherent that perform array manipulations quire efficiently. Typically you use integer variables as indices. Then the Perform Varying with the after option is used to iterate through the array. Many COBOL programmers are not aware of these available feature let alone how to employ them in problem solving.
While serving as an Airline Executive for Trans World Airlines (New York & Kansas City) part of my duties assigned was to manage flight crews for every flight TWA flew (domestically) for a month in advance. That task alone drove many COBOL programmers beyond the brink! But I was not one of them.
When I was assigned to the project I told my supervisor we (me, myself and I) eat this stuff up (WETSU)! Another caveat to the application was that each flight had to recognize the change in time due to usage of daylight savings time. Almost every state adheres to daylight savings time except Arizona and a couple of other places. The project was an overall success to the point my management then turned over all the international flight and told me to do the same thing for all international flights. I said no problem!
When I became the Project Officer for Crew Scheduling approximately one hundred twenty five COBOL programs had the time tables hard coded throughout all the source code of the application. When the application ran it consumed about nineteen hours (wall clock time) to run from beginning to end.
Closer scrutiny of the problem revealed a large portion of the wall clock tine involved was consumed allocating and de allocating the same few files repeatedly.
Being a pioneer of thinking outside the box I examined the code executed and figured a way to allocate each file only once. Then all the code was organized as sub programs and every subprogram that access information for that file was called in the appropriate sequence. This process was repeated until all the data used for the generation of the operational schedules was accessed and utilized. The overall end result was a complete set of operational schedules in a fraction of the time normally required for successful completion.
The nineteen hours turned into only twenty minutes for successful execution. My work was duly noted and I received a cash incentive award of several thousand dollars for the re design of the system and performance improvement.
My next task was to eliminate the need to change the source code of the application twice a year. The twice a year changes covered the spring forward fall back scenario of daylight savings time.
A matrix or table was designed to hold each originating flight departure time followed by each subsequent flight segment departure time. Another leg of the matrix housed the arrival times for each flight segment. That comprises two dimensions of the multi dimensional array designed to accommodate each flight flown by TWA for a month in advance. In the spring forward scenario one hour was added to the departure and arrival times respectively. Of course in the fall back scenario one hour was subtracted from the departure and arrival time respectively. Other matrices accommodated the four time zones for the continental United States. Still other matrices accommodated the fifty states.
Beginning with the outermost matrices the iterations began while the indices were decremented until all matrices were accommodated. The perform varying after option was used for the most frequent number of occurrences in each matrix. Of course by the final iteration the flight schedule for EST, CST, MST and PST were changed to Daylight Savings Time and vice versa. The table was the only code that changed the time required to re compile those one hundred or so programs was eliminated also. Now that I think about that project that was approximately thirty one years ago!
Please feel free to contact me at my web site below for further assistance in this as well as other endeavors. Simply click on the free consultation link at the top of every active page on the web site.
Mr. Arch Brooks, Software Engineer
Leave a Reply

Your email address will not be published. Required fields are marked *