|
This article may need to be cleaned up to meet wikiHow's quality standards. You can help by improving it and removing this notice when complete. Notice added on 2014-12-02. |
The importance of knowing COBOL is quite beneficial even if the language is fifty years old. The language is still being used today to store data in our governments, banks and businesses with little to no signs of changing to newer languages. COBOL programming with DB2 can be very frustrating to learn but the underlying concepts are easier than our thinking and with time anyone can learn it.
Ok,
CloseThis article has not yet passed wikiHow's quality review process. Learn more
CloseThis article has not yet passed wikiHow's quality review process. Learn more
EditHeadline text
- COBOL programs are hierarchical in structure. Each element of the hierarchy consists of one or more subordinate elements. The hierarchy consists of Divisions, Sections, Paragraphs, Sentences and Statements. A Division may contain one or more Sections, a Section one or more Paragraphs, a Paragraph one or more Sentences and a Sentence one or more Statements. We can represent the COBOL hierarchy using the COBOL metalanguage as the below picture.
EditSteps
-
1To describe the IDENTIFICATION DIVISION supplies information about the program to the programmer and the compiler.
-
2To write the ENVIRONMENT DIVISION is used to describe the environment in which the program will run. The purpose of this division is to isolate in one place all aspects of the program that are dependant upon a specific computer, device or ending sequence.
-
3DATA DIVISION - descriptions of the data-information processed by the program. FILE SECTION and WORKING-STORAGE SECTION are included. The LINKAGE SECTION and the REPORT SECTION are additional sections
-
4Procedure Division - contains the code(To manipulate the data in the DATA DIVISION)
-
5Minimum COBOL program - For example, the above program is valid when compiled with the Microfocus NetExpress compiler.
-
6COBOL DB2 PROGRAMMING - Assume we have the following table in DB2(database)
-
7
-
8Host variable declaration VS DB2 - If you use DB2 tool DCLGEN, it will automatically creates this structure and table declaration specified in the table declaration of WORKING-STORAGE SECTION.
-
9SQLCA in WORKING-STORAGE SECTION
-
10DB2 sql statement in the PROCECURE DIVISION
-
11As the above steps, we have completed coding a COBOL-DB2 program.
Article Info
Did this article help you?
Yes
No