Presentation is loading. Please wait.

Presentation is loading. Please wait.

COBOL vs C++ Is C++ suitable as a replacement to COBOL in the mainframe business environment? Michael Riley  Ian Diebert Spring 2017 CS332 – Organization.

Similar presentations


Presentation on theme: "COBOL vs C++ Is C++ suitable as a replacement to COBOL in the mainframe business environment? Michael Riley  Ian Diebert Spring 2017 CS332 – Organization."— Presentation transcript:

1 COBOL vs C++ Is C++ suitable as a replacement to COBOL in the mainframe business environment? Michael Riley  Ian Diebert Spring 2017 CS332 – Organization of Programming Languages

2 Overview Purpose and Scope Introduction Programming Requirements
History Syntactic Differences COBOL Code Statistics C++ Code Statistics Questions

3 Purpose and scope These PowerPoint slides contain information concerning a comparison between the Common Business Oriented Language (COBOL), and C++ in the following regards: Objective Execution timing Lines of code to perform the same operation Binary size on disk Subjective Readability and maintainability of code Ease of learning Lack of adherence to SW design principles

4 introduction Research Hypothesis: Due to the advances of computer hardware and being that COBOL is not operational on modern hardware, we expect C++ to outperform COBOL. There is a fundamental difference between these languages that is apparent within the first sentence of the description of each: C++ is general purpose, statically typed, free-form, multi-paradigm and compiled. COBOL is a compiled English-like computer programming language designed for business use. It is imperative, procedural and, since 2002, object-oriented. These differences in design scope create a void of applicability between these two languages.  This is not to say that C++ cannot replace COBOL yet it does present some significant implementation and migration concerns.

5 Program Requirements Each program C++ and COBOL will be compared to each other based on the above criteria over performing the following tasks: Read in a .CSV file Store the data from the file into memory Randomly generate values Update the entire contents of the file by adding the randomly generated number to a specific field per row of the entire data set Write the data back to a .CSV file Platform and Operating System Information: Windows 7 Professional 64-Bit 8 GB Ram Solid State Hard Drive

6 history C++  In 1983 Bjarne Stroustrup altered the name of the ‘C with classes’ programming language he was designing to C++ C++ was motivated by Bjarne’s work with Simula 67 during his Ph.D thesis, which he found to be very useful but to slow for software development It is of note that the creation of C++ also corresponded with the emergence of ADA which at the time was a direct competitor to C and by extension C++ COBOL COBOL was developed in the early 1960’s to assist business professionals with data processing and transactional interactions. The syntax of COBOL resembles the normal English sentence structure and at first can be confusing to the imperative procedural programmer There are currently a bout 250 million lines of COBOL code running behind todays modern businesses

7

8

9 Syntactic differences
C++ Conditional Expressions If(x == 5){ } C++ Loops While(x == 20){ } For(x = 0; x < 5; x++){ } C++ String Manipulation Resize() Find_fist_of() Insert() Swap() COBOL Conditional Expressions if something is less than or equal to something else then COBOL Loops perform varying rec-counter from 1 by 1 until rec-counter is greater than 1526 COBOL String Manipulation Unstring csv-record delimited by "," into rec-geoid(rec-counter), rec- sumlev(rec-counter), rec-state(rec- counter)…..more things

10 Syntactic differences Cont.
file section.   * This is like file IO but you have to define the attributes of the file first fd csv-file          record is varying in size          from 0 to 16 characters          depending on size-csv-record.      01 csv-record pic x(9999).   * This is the output file description, basically a record written as a line at a time         fd csv.      01 out-rec pic x(9999).      working-storage section.   * This is like declaring a structure, input output goes into each ‘occurrence’    01 my-table.        05  census-data-info occurs 1526 times.          10 rec-geoid    pic 9(10).          10 rec-sumlev   pic 9(3).          10 rec-state    pic 9(1).  * About 26 more attributes … struct Record   {       long long GEOID;       int SUMLEV;       int STATE;   //....about 26 more attributes...      // Inside Main   vector <Record> table;   // File IO   ifstream infile("./all_140_in_04.P3.csv");   

11 COBOL Code statistics COBOL Lines of Code
(no comments, no empty lines) 166 Execution Time About 1.2 seconds Binary Size On Disk Cobol1.exe -> 16kb These functions consumed 63.37% of the total execution time for the program. The functions written for this program, not built in to COBOL or native to MicroFocus, consumed 36.63% of the total program execution time which yields an execution time of seconds. This number reflects what most COBOLER’s refer to as a ‘good enough’ execution time for small COBOL operations. Further analysis of the execution timing reveals that the user defined sorting function took up 26.59% of the total execution time.

12 COBOL code statistics (cont.)
The total lines of code in the COBOL program could have been reduced by about 25 lines. According to research 1.2 seconds is VERY long for a COBOL file IO and sort operation. This is most likely attributed to running COBOL code in a non MAINFRAME setting, not using Job Control Language (JCL) files, COBOL Copy (CPY) files, or any other of the many resources that COBOLER’s typically make use of. The size of the binary executable on disk is probably about the right size since COBOL was created during a time where memory management is crucial. MicroFocus programming environment functions consumed 63.37% of the total execution time for the program. The functions written for this program, not built in to COBOL or native to MicroFocus, consumed 36.63% of the total program execution time which yields an execution time of seconds. This number reflects what most COBOLER’s refer to as a ‘good enough’ execution time for small COBOL operations. Further analysis of the execution timing reveals that the user defined sorting function took up 26.59% of the total execution time. While the COBOL SORT operation does work on tables, with some modification, it was determined wiser to write a Bubble Sort method. not using the built-in SORT operation is not a fair for COBOL

13 C++ Code statistics optimization o2
C++ Lines of Code (no comments, no empty lines) 221 Execution Time About 542 Milliseconds Binary Size On Disk cs332.exe -> 47kb the ‘<<’ operator in some fashion, while other times the ‘getline’ function would take that place. Whenever it was run, it consistently ended with the result that one function would take ~60% of the work

14 C++ Code statistics – optimization disabled
C++ Lines of Code (no comments, no empty lines) 221 Execution Time About 14 seconds! Binary Size On Disk cs332.exe -> 69kb the ‘<<’ operator in some fashion, while other times the ‘getline’ function would take that place. Whenever it was run, it consistently ended with the result that one function would take ~60% of the work

15 C++ code statistics (cont.)
The total number of lines of code in the C++ program was around 220; this was primarily due to heavy compartmentalization and extremely explicit declaration, and could have been reduced by around 50 lines of code with very little effort C++ is not specifically optimized for the workload however its ability as a general purpose language may explain its increased speed of COBOL in this basic test The size of the executable is larger than its COBOL counterpart due to the fact that modern C++ does not suffer from the same memory constraints and can afford the usage MicroFocus programming environment functions consumed 63.37% of the total execution time for the program. The functions written for this program, not built in to COBOL or native to MicroFocus, consumed 36.63% of the total program execution time which yields an execution time of seconds. This number reflects what most COBOLER’s refer to as a ‘good enough’ execution time for small COBOL operations. Further analysis of the execution timing reveals that the user defined sorting function took up 26.59% of the total execution time. While the COBOL SORT operation does work on tables, with some modification, it was determined wiser to write a Bubble Sort method. not using the built-in SORT operation is not a fair for COBOL

16 Conclusions Overall our efforts were not a direct comparison between the two programming languages due to our inability to write COBOL on an IBM mainframe and business environment. Further testing is required to reach a definitive answer as to whether COBOL should be replaced by C++ in industry. Such testing is beyond the capability and scope of our efforts for CS332; however, this does seem to be a topic of future research, perhaps at the master’s level or above. Our goal in performing further research would be to find clear examples of code and data used in industry, and to find the hardware capable of running it. With this information we would be able to better test against C++, as well as perhaps multiple other languages that have been proposed as competitors to COBOL. MicroFocus programming environment functions consumed 63.37% of the total execution time for the program. The functions written for this program, not built in to COBOL or native to MicroFocus, consumed 36.63% of the total program execution time which yields an execution time of seconds. This number reflects what most COBOLER’s refer to as a ‘good enough’ execution time for small COBOL operations. Further analysis of the execution timing reveals that the user defined sorting function took up 26.59% of the total execution time. While the COBOL SORT operation does work on tables, with some modification, it was determined wiser to write a Bubble Sort method. not using the built-in SORT operation is not a fair for COBOL

17 questions? Michael Riley Embry-Riddle Aeronautical University
Computer Engineering Electrical Engineering Ian Diebert Cited Sources Links:


Download ppt "COBOL vs C++ Is C++ suitable as a replacement to COBOL in the mainframe business environment? Michael Riley  Ian Diebert Spring 2017 CS332 – Organization."

Similar presentations


Ads by Google