0% found this document useful (0 votes)
24 views13 pages

Module 1

Uploaded by

totorouuu5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

Module 1

Uploaded by

totorouuu5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

PROGRAMMING 3 (STRUCTURED PROGRAMMING)

INSTRUCTIONAL MATERIAL

General Overview

This Instructional Material gives a basic knowledge on structured programming which focuses
specifically on COBOL Programming language. COBOL stands for Common Business Oriented
Language. It is a high-level programming language design specifically for business applications.
COBOL is primarily used in business, finance, and administrative systems for companies and
governments.

General Objectives

After completion of this Instructional Material student should be able to:

1. Understand concept or logic behind the COBOL program


2. Visualize what COBOL program is supposed to do
3. Fix logic and syntax errors in COBOL
4. Develop a simple application using COBOL Programming language
5. Appreciate of what programmers and computers can do.

“Everybody in this country should learn how to program a computer… because it teaches you how
to think” – Steve Jobs

General Course Materials

Watch:
You can watch these Youtube link for more information about COBOL Programming Language:
https://www.youtube.com/watch?v=ZOLB4KqHmBs
https://www.youtube.com/watch?v=TBs7HXI76yU
https://www.youtube.com/watch?v=AT0Qtl2Ub2c

Read:

For your course guide, read the Programming 3 Course Syllabus and the Instructional Materials.

Activities/ Assessments:

Make sure that you read and understand the each module to answer the assessment activity at the
end of each module.
Module 1

Overview:
A flowchart is a formalized graphic representation of a logic sequence, work or
manufacturing process, organization chart, or similar formalized structure. The purpose of a flow
chart is to provide people with a common language or reference point when dealing with a project
or process.

Module Objectives:
After successful Completion of this module, you should be able to:

● Discuss the basic and advanced techniques of constructing process, data and business
process modeling flowchart

● Know and understand the basic concepts of COBOL programming

● Learn the modularized notation of the flowchart


A Flowchart, is a graphical representation of algorithm, workflow or process, is incredibly
versatile. It helps simplify a process to allow easy troubleshooting.

The three most popular flowchart types are:

1. Process flowchart (PFD) is a diagram that illustrates and analyzes the overall flow of
activities in producing a product or service, which is always used in process engineering
and chemical industry where the depiction of the relationship between major components
needed. This type of flowchart can be used for:

● Oil and petroleum refining


● Natural gas systems
● Green energy, such as wind and solar power
● Water treatment and processes
● Piping and irrigation systems
● Electrical power plants

2. Data Flowchart (DFD), one of the main tools for structural analysis, shows the way data is
processed. We can use the data flowchart for:

● Data management
● Modeling process aspects
● An overview of the system
● Visualization of data processing
● Where the data will come from and go to

3. Business Process Modeling Diagram (BPMN), a graphical representation for specifying


business processes in a workflow, is used for creating graphical models of business process
operations. This type of flowchart can assist us in:

● Analytical representation of business processes


● Illustrating business processes of an organization
● Process improvement
● Simplifying understanding of business activities flows and processes

Flowchart Symbols and Their Usage

Name
Flowchart Symbol
Usage

Process

represents a step in your process.


Predefined process

indicates a set of steps that combine to create a sub-process that is defined elsewhere, often on
another page of the same drawing.

Decision

indicates a point where the outcome of a decision dictates the next step. There can be multiple
outcomes, but often there are just two - yes and no.

Start points

indicates the starting of a process.

Terminal points

indicates the ending points of a process.

Data shape

indicates that information is coming into the process from outside, or leaving the process.
Delay shape

represents a waiting period where no activity is done. In Process Mapping, delays are often
important as they may result in adding to the cost of the product or simply delaying its
production.

Database shape

Use this shape for a step that results in information being stored.

Step

represents a single step within a process, and usually contains the name of a specific action.

Page symbols

refer to individual web pages, which may or may not contain multiple elements.

File symbols

represent those data elements that exist independently of navigational properties outside of that
page, e.g., audio sounds, movie clips, or a portable document file (PDF).

Decision point

indicates a sequence in the process at which the end user chooses an option, i.e., a "yes-no", or
"true-false" response, and then branches to different parts of the flowchart.

Arrows and connecting lines

diagram the logical progression through the course, subject to the choices made at decision or
action points within the process.

Input/action symbol
represents a user response that directs the course flow from that point onwards, i.e., an online
test or questionnaire form.

Conditional selector

is similar to the conditional branch except that the user has the option to choose from a number
of paths that will fulfill the requested conditions, e.g., the results of a search engine request.

Annotations

provide helpful comments or explanations, e.g. denoting the location where an undeveloped new
page/process will fit into the navigational flow structure, or notes for specific team members for
further development.

Flow references and flow areas

are symbols for reusable sequences, such as logging in with a specific user id and password to
enter the course or to initiate an on-line quiz. The flow reference symbol acts as a placeholder for
the flow area sequence in the chart in every situation in which it is repeated. Flow area is used as
a flow area. It documents sections that share similar components/repeated steps within that flow,
and requires the use of the following two symbols: entry and exit points.

Exit point

concludes the subroutines, such as when the proper user id and password are verified, and
documents where the user re-enters the master flowchart.

Entry point

documents the place within the master flowchart where the process deviates into a subroutine.

Reference

is used as a connecting point when the flowchart necessitates using more than one page, or refers
to a complicated subroutine that would be impossible to contain on the main flowchart page.

On-page reference

indicates that the next or previous step is somewhere else on the flowchart. It is particularly
useful for large flowcharts.

Off-page reference
use a set of hyperlinks between two pages of a flowchart or between a sub-process shape and a
separate flowchart page that shows the steps in that sub-process.

Flowchart Shapes

The designers can click this multi-shape to set to any of the following shapes: Data, Document,
Decision, or Process. Any text you type onto the shape, or information you add to its Shape Data,
remains with the shape.

Document

represents a step that results in a document.

Examples for Algorithm Flowcharts

Algorithms and flowcharts are two different ways of presenting the process of solving a problem.
Algorithms consist of a set of steps for solving a particular problem, while in flowcharts, those
steps are usually displayed in shapes and process boxes with arrows. So flowcharts can be used for
presenting algorithms.

Flowcharts are diagrams that visually present the process of solving problems. The steps of
creating algorithms flowcharts are described below.
Rules of Drawing Flowcharts for Algorithms

There are some basic shapes and boxes included in flowcharts that are used in the structure
of explaining steps of algorithms. Knowing how to use them while drawing flowcharts is crucial.
Here are some rules that should be known:

1. All boxes of flowcharts are connected with arrows to show the logical connection between
them,
2. Flowcharts will flow from top to bottom,
3. All flowcharts start with a Start Box and end with a Terminal Box

Examples of Flowcharts for Algorithms

These examples will help you get a better understanding of flowchart techniques.
Example 1: Calculate the Interest of a Bank Deposit

Algorithm:

● Step 1: Read amount,


● Step 2: Read years,
● Step 3: Read rate,
● Step 4: Calculate the interest with formula "Interest=Amount*Years*Rate/100
● Step 5: Print interest,

Flowchart:

Example 4: Determine Whether A


Student Passed the Exam or Not:
Algorithm:

● Step 1: Input grades of 4 courses M1, M2, M3 and M4,


● Step 2: Calculate the average grade with formula "Grade=(M1+M2+M3+M4)/4"
● Step 3: If the average grade is less than 60, print "FAIL", else print "PASS".

Flowchart:

Drawing a Structured Flowchart

Structure You can make your flowcharts easier to understand and less subject to errors by
s using only a fixed set of structures. These structures include:

● Sequence
● Decision
● Loop
● Case

Whether you are flowcharting software programs or business processes, using only
these structures will make it easier to find and correct errors in your charts.
Each structure has a simple flow of control with one input and one output. These
structures can then be nested within each other. Any chart can be drawn using
only these structures. You do not have to use GOTO or draw spaghetti diagrams
just because you are drawing a flowchart. You can draw structured flowcharts.

The flowchart above demonstrates a sequence of steps. The reader would start at the Start shape
and follow the arrows from one rectangle to the other, finishing at the End shape. A sequence is
the simplest flowcharting construction. You do each step in order.

Decision

This structure is called a decision, "If Then.. Else" or a conditional. A question is asked in the
decision shape. Depending on the answer the control follows either of two paths. In the chart
above, if the temperature is going to be less than freezing (32 degrees Fahrenheit) the tomatoes
should be covered.
Loop

This structure allows you to repeat a task over and over. The red chart above on the left does the
task and repeats doing the task until the condition is false. It always does the task at least once.
The green chart on the right checks the condition first and continues doing the task while the
condition is true. In the green chart the task may not be done at all. You can also have the
conditions reversed and your loop is still a structured design loop.

The above chart is a "For Loop." In this example the task is performed 10 times as X counts from 0
to 10. Depending on the condition, the task may not be performed at all.
There is also a "For Each" structure that is like the for loop, but has no counter. It will go through
each item of a collection and do the task. You don't have to know the length of the collection or
use a counter. It is essentially saying "do this for every item in the collection".

Case
The structure above is called the case structure or selection structure. The
decision works fine if you have only two outputs, but if there are several, then
using multiple decisions makes the chart too busy. Since the case structure can
be constructed using the decision structure, it is superfluous, but useful. The
case structure helps make a flowchart more readable and saves space on the
paper.

Pseudo-code & Flowchart Module Notation

● Pseudo-Code Module Standards


(most of these standards are implied by the example pseudo-code modular
decomposition earlier in these notes.)

module names
Module names are composed of 2 to 4 words. The first word should be a verb; the last
word should be a noun; intermediate words should be adjectives which qualify the noun.
The first letter of the first word should be capitalized and (within pseudo-code) the words
should be joined with underscores.
e.g. Calculate_Net_Pay

reference to a module

When we wish to perform the activities described by a sub-module, the pseudo-code


simply states the sub-module name as if it were a statement or expression by itself.
Typically the sub-module name is "marked" in some way which makes it obvious that it is a
reference to a sub-module; the form used here, is to enclose the sub-module name in
"square brackets" representing a "named" box whose exact contents are "hidden" from the
current view. .

module definition

A pseudo-code module has the same form as a complete program pseudo-coded algorithm,
except that the terminator used for a sub-module is RETURN (instead of END).

● Flowchart Module Standards


The following image demonstrates the method for drawing modular flowcharts based on
the top two levels of the same "Employee Pay" problem as previously used in the modular
pseudo-code and the hierarchy chart examples.
Note:
o references to a sub-module are drawn as boxes with vertical double sides.
o a sub-module flowchart definition starts with the sub-module name (in a rounded
box) and ends with a Return (also in a rounded box); in all other respects
a sub-module flowchart definition is the same as a normal program flowchart
definition.

Course Materials:

The edrawsoft.com and rff.com have free trial versionsand could be downloaded to be used in
the subject for flowchart creation. The following URL will help you to be more fluent in
flowcharting

https://www.edrawsoft.com/flowchart/three-types-of-flowchart.html

https://www.edrawsoft.com/flowchart-symbols.html

https://www.edrawsoft.com/algorithm-flowchart-examples.html

https://www.rff.com/structured_flowchart.php

http://elearning.algonquincollege.com/coursemat/pincka/dat2219d/lectures/27-Modules.htm#re
f01b

You might also like