Hello, this is Kevin. Did this ever happen to you? Did you tell your friends directions for how to meet you? Sometimes their interpretation is different than your explanation, how embarrassing. Then along came GPS and MapQuest. In the first decade of COBOL, many people had no map, if you will, to follow as they wrote COBOL code, they just kept typing away. When one person retired and handed their programs off to a new person, it oftentimes was very, very difficult for the new person to interpret what the program was doing. Along came some smart people promoting structured COBOL. Structure development brings clarity, quality, and reduces development time by using sequence, selection, and iteration, block structures, and subroutines. In this lesson, we're going to learn how to describe the components of structured programming. We're going to code sequence, selection, and iteration. Those are the only three things we need to write COBOL programs. We're going to remove GO TO statements, replacing them with structured syntax. We're going to be able to create readable and maintainable COBOL code, recognize and correct unstructured code. Then consider this, depending on where you are working right now, many places have COBOL programming standards. You may want to consider those, find out what they are so that people that you're working with are all on the same page. What are the advantages of structured COBOL? It encourages developmental discipline, programs are much more reliable, the logic is much easier to follow, the program is more easily to maintain and make changes to, the program is documented very well, some studies have shown that productivity increases anywhere from 70 percent to 300 percent by using structured COBOL, and then the testing improves with modules that can be tested independently and separately. What are the elements of structured COBOL? Well, there's three control logic structures, they are sequence, selection, and iteration. Every program will use these and these only. Every paragraph is limited to one entry and one exit, only one place to get in, one place to get out. The GO TO command is only used to branch to the exit statement nowhere else. Now, modularity builds simplicity for every program, every subprogram, every section and every paragraph. When any of these become too complicated, it's very simple, what you do is you break the module down into smaller modules. Now sequence structure involves making the program execute in sequence, similar to people lining up in a queue in the grocery store, each box in the first diagram represents a paragraph with a specific action to occur, action number 1 followed by action number 2, and so on. The first selection structure diagram shows how a paragraph will execute code based on the true or false results of a condition. Either action 1 runs or action 2 runs, but not both of them. The second diagram called a case structure allows for more than two actions based on the value of a variable. The first example here, iteration structure first checks whether the condition is true or false. When false, it executes the set of actions, then returns to the question again. As long as it is false, it loops, if true, the loop is going to end. This is called a test before. The second diagram has a test after, iteration structure executes actions before checking the true or false condition, then will loop or end accordingly. Do you see how these are different? Here are six ways for all of us to improve readability. Indented words and picture clauses, lining them up with each other is very helpful. Descriptive data names and paragraph names logically grouped together, why? Because people maintaining the code can find things much, much faster if three things are found, data names with descriptive names, paragraph names numbered in ascending sequence, and data names with similar functions, such as switches and counters when they're all grouped together. The third thing to think about is limit to using only one data-name per line, and avoid the use of the word "NOT" whenever possible. Number 4, place "THEN & ELSE" on separate lines with indentation. Two more to go. Liberally sprinkle comments, especially in complex areas, and use blank lines for separation. Consider if COBOL programming standards exist where you are working, follow them in your development and also in your maintenance activities. What we just did is help you to describe the components of structured programming, help you to code sequence selection and iteration structures, remove the GO TO from programs, replacing them with structured syntax, create readable and maintainable COBOL code, recognize and correct unstructured code, and then again, just consider where you're working if there are COBOL programming standards to use those when you're developing new code and when you're maintaining code that's been around for a while. Good luck.