You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: COBOL Programming Course #2 - Advanced Topics/COBOL Programming Course #2 - Advanced Topics.md
+79Lines changed: 79 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,14 +40,93 @@ Business application solutions were architected decades ago using programming la
40
40
-**Using VSCode and Zowe Explorer**
41
41
42
42
## Enterprise COBOL APIs
43
+
IBM mainframe flagship operating system, z/OS, includes software that has enabled large scale business applications for decades. The software is frequently referred to as 'middleware'. Examples of z/OS 'middleware' is Db2, a relational database, CICS, transactional processor, IMS, both transactional and hierarchical database, and MQSeries, a mechanism to store and forward data between systems asynchonously.
43
44
44
45
### z/OS Middleware
46
+
A fundamental capability of z/OS middleware software is communication enablement of programming languages. The z/OS middleware software includes documentation and examples of how any specific programming language can communicate with the specific z/OS middleware software. A programming language, such as Enterprise COBOL, would use documented interfaces and techniques to initiate services and pass data between the COBOL application program and the middleware.
45
47
46
48
### COBOL API Communication with Middleware
49
+
Each middleware has unique reserved words available to Enterprise COBOL.
50
+
51
+
Enterprise COBOL unique API reserved words are in Example 1.
52
+
53
+
```
54
+
EXEC SQL
55
+
EXEC CICS
56
+
CALL 'MQ...'
57
+
CALL 'CBLTDLI'
58
+
```
59
+
*Example 1. COBOL API Reserved Words*
60
+
61
+
Each of the above COBOL API's enable the program to communcate with Db2, CICS, MQSeries, and IMS respectively. When the COBOL source program is compiled, the API reserved words expand the number of lines in the COBOL source code. The expanded lines of code does not need to be fully understood by the COBOL programmer. The COBOL programmer uses an API to accomplish a task within the logic and the middleware expanded code follows through with accomplishing the task.
47
62
48
63
### COBOL EXEC SQL
64
+
SQL, Structured Query Language, is the documented standard for communicating will all relational databases. Enterprise COBOL is capable of including Db2 for z/OS SQL. A few simple COBOL EXEC SQL reserved words are shown in Example 2.
EXEC SQL FETCH CUR1 INTO :CUSTOMER-RECORD END-EXEC.
99
+
PERFORM PRINT-AND-GET1
100
+
UNTIL SQLCODE IS NOT EQUAL TO ZERO.
101
+
EXEC SQL CLOSE CUR1 END-EXEC.
102
+
```
103
+
*Example 2. COBOL SQL Statements*
49
104
50
105
### COBOL Data Items
106
+
While the EXEC SQL is expanded into additional lines of code at compile time,
107
+
COBOL needs data items to manage the data passed between the COBOL program and Db2 table.
108
+
109
+
The fields in the Db2 table record were defined using CREATE TABLE SQL. The EXEC SQL DECLARE in Table xx describes the Db2 table format within the COBOL program. The COBOL programmer with knowledge of the Db2 table format can code the table format or let Db2 for z/OS generate the code using a DCLGEN utility.
110
+
111
+
Observe ":CUSTOMER-RECORD" in the EXEC SQL FETCH statement. A colon (:) precedes COBOL program defined variables that are used in SQL statements so that Db2 can distinguish a variable name from a column name. Example 3. shows the COBOL program data items describing the COBOL program variable names.
0 commit comments