Skip to content

Commit 36f7f10

Browse files
authored
Merge branch 'master' into Update-COBOL-Numerical-Values
2 parents a7bb0ff + 44966a5 commit 36f7f10

File tree

6 files changed

+279
-10
lines changed

6 files changed

+279
-10
lines changed

COBOL Programming Course #1 - Getting Started/Labs/cbl/CBL0010.cobol

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,27 @@
3838
10 USA-STATE PIC X(15).
3939
05 RESERVED PIC X(7).
4040
05 COMMENTS PIC X(50).
41-
*
41+
* The USAGE Clause specifies the storage of a data item,
42+
* e.g USAGE IS COMP-3, or just COMP-3.
43+
* COMP-3 is the equivalent of packed-decimal, frequently used
44+
* rather than COMP-1(floating-point), COMP-2(long floating-point)
45+
* COMP-4(binary) and COMP-5(native binary).
46+
* When no value for USAGE Clause is specified, Default value is
47+
* DISPLAY. To do an arithmetic operation with a DISPLAY number,
48+
* the program must first convert the characters to a binary
49+
* number, execute the operation and convert it back,
50+
* which is less eficient than a computational data type.
51+
*
4252
WORKING-STORAGE SECTION.
4353
01 FLAGS.
4454
05 LASTREC PIC X VALUE SPACE.
4555
*
4656
01 TLIMIT-TBALANCE.
4757
05 TLIMIT PIC S9(9)V99 COMP-3 VALUE ZERO.
4858
05 TBALANCE PIC S9(9)V99 COMP-3 VALUE ZERO.
59+
* Hint: to know which character format is being used,
60+
* you can type HEX ON on the command line and compare to
61+
* a ASCII/EBCDIC Table. then HEX OFF to turn hex numbers off
4962
*
5063
01 HEADER-1.
5164
05 FILLER PIC X(20) VALUE 'Financial Report for'.

COBOL Programming Course #2 - Advanced Topics/COBOL Programming Course #2 - Advanced Topics.md

Lines changed: 184 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,190 @@ header-includes:
1919
linkcolor=blue}
2020
---
2121
\newpage
22-
# COBOL Challenges
22+
# COBOL Application Programming Interface (API)
23+
API is the acronym for Application Programming Interface. An API allows two applications to communicate. We use API's everyday from our phones, personal computers, using a credit card to make a payment at a point of sale, etc.
24+
25+
Today's digital infrastructure is instrumented and interconnected. It is the API's that enable the "instrumented" network to be "interconnected". As a result, API has become a highly used acronym in the technology arena. The phrase "API Economy" became strategic term since Forbes declared 2017 "The Year of the API Economy".
26+
27+
Business application solutions were architected decades ago using programming language API's. Long before API became a strategic technology category, mainframe application developers understood the acronym as a way to enable a programming language to communicate with other software. The value of being a programmer in any specific programming language increased by understanding and using API's.
28+
29+
- **Enterprise COBOL APIs**
30+
- **z/OS Middleware**
31+
- **COBOL API Communication with Middleware**
32+
- **COBOL EXEC SQL**
33+
- **COBOL Data Items**
34+
35+
- **SQL Capability within Enterprise COBOL**
36+
- **Enterprise COBOL Application Programming and SQL Guide**
37+
- **Db2 Data Base Administration (DBA) vs Application Programming**
38+
39+
- **Lab**
40+
- **Using VSCode and Zowe Explorer**
41+
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.
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.
47+
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.
62+
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.
65+
66+
```
67+
WORKING-STORAGE SECTION.
68+
*****************************************************
69+
* SQL INCLUDE FOR SQLCA *
70+
*****************************************************
71+
EXEC SQL INCLUDE SQLCA END-EXEC.
72+
*****************************************************
73+
* SQL DECLARATION FOR VIEW ACCOUNTS *
74+
*****************************************************
75+
EXEC SQL DECLARE my-acct-tbl TABLE
76+
(ACCTNO CHAR(8) NOT NULL,
77+
LIMIT DECIMAL(9,2) ,
78+
BALANCE DECIMAL(9,2) ,
79+
SURNAME CHAR(20) NOT NULL,
80+
FIRSTN CHAR(15) NOT NULL,
81+
ADDRESS1 CHAR(25) NOT NULL,
82+
ADDRESS2 CHAR(20) NOT NULL,
83+
ADDRESS3 CHAR(15) NOT NULL,
84+
RESERVED CHAR(7) NOT NULL,
85+
COMMENTS CHAR(50) NOT NULL)
86+
END-EXEC.
87+
*****************************************************
88+
* SQL CURSORS *
89+
*****************************************************
90+
EXEC SQL DECLARE CUR1 CURSOR FOR
91+
SELECT * FROM my-acct-tbl
92+
END-EXEC.
93+
94+
PROCEDURE DIVISION.
95+
*------------------
96+
LIST-ALL.
97+
EXEC SQL OPEN CUR1 END-EXEC.
98+
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*
104+
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.
112+
113+
```
114+
*****************************************************
115+
* STRUCTURE FOR CUSTOMER RECORD *
116+
*****************************************************
117+
01 CUSTOMER-RECORD.
118+
02 ACCT-NO PIC X(8).
119+
02 ACCT-LIMIT PIC S9(7)V99 COMP-3.
120+
02 ACCT-BALANCE PIC S9(7)V99 COMP-3.
121+
02 ACCT-LASTN PIC X(20).
122+
02 ACCT-FIRSTN PIC X(15).
123+
02 ACCT-ADDR1 PIC X(25).
124+
02 ACCT-ADDR2 PIC X(20).
125+
02 ACCT-ADDR3 PIC X(15).
126+
02 ACCT-RSRVD PIC X(7).
127+
02 ACCT-COMMENT PIC X(50).
128+
```
129+
*Example 3. COBOL Data Item for storing variables where Db2 is the data source*
130+
131+
## SQL Capability within Enterprise COBOL
132+
Learning SQL is a separate technical skill. The objective of this brief chapter is familiarization with Enterprise COBOL use of SQL API. A COBOL program is capable of any SQL communication with Db2 for z/OS assuming necessary authority is granted. SQL has four catagories as outlined in Example 4. Learning SQL is necessary for a COBOL programmer to become proficient with using the Db2 API for a variety of possible applications where COBOL provides the what, how, and when logic of executing specific SQL.
133+
134+
```
135+
DDL - Data Definition Language
136+
CREATE
137+
ALTER
138+
DROP
139+
140+
DML - Data Manipulation Language
141+
SELECT
142+
INSERT
143+
UPDATE
144+
DELETE
145+
146+
DCL - Data Control Langauge
147+
GRANT
148+
REVOKE
149+
150+
TCL - Transaction Control Language
151+
COMMIT
152+
ROLLBACK
153+
```
154+
*Example 4. SQL Categories*
155+
156+
### Enterprise COBOL Application Programming and SQL Guide
157+
Db2 for z/OS V12 is the most current release of Db2 at the moment. The Db2 V12 for z/OS Application Programming and SQL Guide is available using internet search SC27-8845, the Db2 for z/OS professional manual number. Db2 V12 for z/OS SQL Reference is also necessary to advance programming API capability (SC27-8859).
158+
159+
### Db2 Data Base Administration (DBA) vs Application Programming
160+
In large enterprise, the roles and responsibilities are divided for a number of reasons. The responsibility of the DBA would include the DDL and DCL outlined in Example 4. The DBA is responsibile for managing the entire relational data base environment to insure availability, security, performance, etc. The system programmers and DBAs frequently setup the application development procedures for COBOL programmer development, testing, and maintenance of the COBOL business applications. A COBOL application programmer is typically provided documented procedures to follow to apply their COBOL programming and SQL API expertise.
161+
162+
Enterprise COBOL is a learning journey. Each Enterprise COBOL API is a separate learning journey. As is the case with most professional endeavors, learning, repetition, and applying what is learned is re-iterative process leading to advanced skill levels.
163+
164+
## Lab
165+
The lab contains data used in previous labs from "COBOL Programming Course #1 - Getting Started" where the data source was sequential data set, then a VSAM data set. The lab provides JCL to create a personal Db2 table in a DBA-created database name using a DBA-created storage group. The DBA-created storage group directs the create tablespace and table to specific disk storage volumes.
166+
167+
The lab contains Enterprise COBOL source code with Db2 APIs along with the JCL to compile and execute the COBOL programs.
168+
169+
### Using VSCode and Zowe Explorer
170+
Zowe Explorer is currently without the ability to execute Db2 SQL interactively. It is inevitable Zowe Explorer will eventually have the capability of connectiong to relational databases and executing SQL.
171+
172+
Therefore, JCL members were created to create and load user tables following examples provided.
173+
174+
1. Submit `zos.public.db2.jcl(db2setup)`
175+
The result is new JCL and CBL members copied into personal JCL and CBL libraries
176+
177+
2. SUBMIT JCL(CRETBL)
178+
The result is a personal Db2 tablespace, table, indexspace, and index
179+
180+
3. SUBMIT JCL(LOADTBL)
181+
The result is data loaded into the personal Db2 tablespace, table, indexspace, and index
182+
183+
4. Edit each COBOL source code member in your CBL partition data set changing all occurrences of Z# to your personal ID. Example - If your ID was Z80001, then change all occurrences of Z# to Z80001.
184+
185+
5. SUBMIT JCL(CBLDB21C)
186+
The result is compile of CBL program CBLDB21 and a Db2 Plan needed for program execution
187+
188+
6. SUBMIT JCL(CBLDB21R)
189+
The result is execution of COBOL program CBLDB21 to read the Db2 table and write each record from the Db2 table .
23190

24-
As you have now handled some basic exercises, we have prepared a new section containing more advanced exercises that test your ability to resolve bugs and other issues in COBOL programs. Each exercise will have a short description and a goal to be accomplished.
191+
7. Two additional COBOL programs with Db2 API exist, CBLDB22 and CBLDB23 using the same Db2 table as the data source.
25192

26-
In case you get stuck, a blog with instructions will be published shortly after each exercise.
193+
194+
\newpage
195+
# COBOL Challenges
196+
As you have now handled some basic exercises, we have prepared a new section containing more advanced exercises that test your ability to resolve bugs and other issues in COBOL programs. Each exercise will have a short description and a goal to be accomplished.
27197

28198
Happy Coding!
29199

30-
\newpage
200+
- **COBOL Challenge - Debugging**
201+
- **COBOL Challenge - The COVID-19 Reports**
202+
- **COBOL Challenge - The Unemployment Claims**
203+
- **Hacker News Rankings for Mainframe/COBOL Posts**
31204

205+
\newpage
32206
## COBOL Challenge - Debugging
33207

34208
It is 2020 in Washington, D.C. John Doe runs a program which provides financial reports on US Presidents and tallies the number of reports from the state of Virginia. Everything seems OK. (see below)
@@ -49,6 +223,7 @@ Can you fix the code to get the correct result? The new source code is named **C
49223

50224
You can find them in the github repository for the COBOL course, in the subfolder **/COBOL Programming Course #2 - Advanced Topics/Challenges/Debugging**.
51225

226+
\newpage
52227
## COBOL Challenge - The COVID-19 Reports
53228

54229
Today, you are tasked to create a COVID-19 Summary Report of all the countries around the world, using information from the COVID19API website.
@@ -65,7 +240,7 @@ Today, you are tasked to create a COVID-19 Summary Report of all the countries a
65240

66241
3. Using Zowe, upload the CSV file to the mainframe.
67242

68-
**Hint:** You can use the command `zowe files ul ftds file location” “dataset name` to upload the CSV file to the mainframe.
243+
**Hint:** You can use the command `zowe files ul ftds "file location" "dataset name"` to upload the CSV file to the mainframe.
69244

70245
4. Create a new member in your *.CBL data set to write your COBOL program.
71246

@@ -107,17 +282,18 @@ If you want a more challenging approach, try the optional tasks below:
107282
108283
To check the solution, refer to the blog post [here](https://medium.com/@jessielaine.punongbayan/solution-covid-19-reports-cobol-challenge-6c509579e3fe?source=friends_link&sk=5a662034a03c91d639b77267ed6abfc9).
109284
110-
Happy Coding! 😉
285+
Happy Coding!
111286
112287
_Disclaimer: This challenge is also posted in [Medium.com](https://medium.com/@jessielaine.punongbayan/cobol-challenge-covid-19-reports-ee03a946bd23)._
113288
289+
\newpage
114290
## COBOL Challenge - The Unemployment Claims
115291
116292
Now let's try a more advanced challenge! Your task is to create an end-to-end solution. Our end goal is to build an application that will fire Zowe APIs to the mainframe and display the result in the application. This is how the flow would look:
117293
118294
![](Images/cobolchClaims-img1.png)
119295
120-
_Of course, you do not have to complete the whole challenge if you do not want to. But it would be great if you do_ 😉
296+
_Of course, you do not have to complete the whole challenge if you do not want to. But it would be great if you do_
121297
122298
### Our Data
123299
@@ -200,12 +376,11 @@ Add more functionality to your COBOL Sub-routine like:
200376
201377
I hope that by taking this challenge, you will be able to learn something new!
202378
203-
Happy Coding! 😉
379+
Happy Coding!
204380
205381
_Disclaimer: This challenge is also posted in [Medium.com](https://medium.com/@jessielaine.punongbayan/zowe-cobol-challenge-the-unemployment-claims-2e35a42eabaa)._
206382
207383
\newpage
208-
209384
## Hacker News Rankings for Mainframe/COBOL Posts
210385
211386
![](Images/hacker-img1.png)

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,10 @@ This project is openly governed as defined in [GOVERNANCE.md](GOVERNANCE.md).
3636
## Credits
3737

3838
The courseware materials were made available through a joint collaboration IBM, it's clients, and American River College and proposed as a new project by IBM.
39+
40+
## Video Course Links
41+
42+
- [IBM Digital Learning Platform](https://learn.ibm.com/course/view.php?id=7552)
43+
- [Coursera](https://www.coursera.org/learn/cobol-programming-vscode?)
44+
- [Pluralsight](https://www.pluralsight.com/courses/learning-cobol-programming-vscode)
45+
- [YouTube](https://www.youtube.com/watch?v=RdMAEdGvtLA)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Meeting Agenda:
2+
### Tues, Aug 11th 8:00 a.m PST / 11:00 a.m EST 
3+
4+
- TSC Members Introductions - All
5+
- Project Update - Sudharsana
6+
- System Disk Storage guidelines - Paul
7+
- ZOWE Update - Mike
8+
- COBOL Working Group Update - Dr. Cameron Saey
9+
- Q&A
10+
11+
## Meeting Minutes:
12+
Attendees: All Core team members & few community participants
13+
14+
1. Core Team members introduced themselves
15+
2. Sudharsana shared a quick update on COBOL Course
16+
- requested for community help with getting content added to Course #2
17+
3. Paul shared that he is working on Disk Storage guidelines and will share soon
18+
- Request to be mindful when allocating system resources
19+
4. Mike gave an overview on ZOWE, a sister project on OMP
20+
5. Dr. Cameron Saey shared about the new initiative called COBOL Working group. This latest initiative on OMP is looking to bring academic attention to COBOL.
21+
5. Q&A - No questions
22+
23+
#### Next Meeting
24+
Tues, Sept 8th 8 a.m PST / 11 a.m EST
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Meeting Agenda:
2+
### Tues, Oct 13th 8:00 a.m PST / 11:00 a.m EST 
3+
4+
- TSC Members Introductions - All
5+
- Project Update & PDF Releases - Mike
6+
- Db2 API Demo - Radha
7+
- Q&A
8+
9+
## Meeting Minutes:
10+
Attendees: All Core team members & few community participants
11+
12+
1. Core Team members introduced themselves
13+
2. Mike shared a quick update on COBOL Course
14+
- requested community participation in building up content for Course #2
15+
- shared the content in v2.1.0 of the COBOL Course PDF
16+
3. Radha went over the Db2 work she has been doing - check out a recording [here](https://drive.google.com/file/d/1ufFW1ENFM_3EITLiAlGs7RmhOrfJxfoD/view?usp=sharing)!
17+
- The recording of the session will be available soon, stay tuned!
18+
4. Q&A
19+
- Q: Is this course content is available publicly?
20+
A: Yes. This is open to anyone and everyone to use in their learning journey. There is also a video course of this COBOL content available
21+
on IBM Digital Learning Platform at no cost, Coursera and Pluralsight.
22+
23+
5. September was a wealth of information shared through these various conferences:
24+
- [IBM Z Day 2020 Replays](https://ibmzday-vconf.bemyapp.com/#/event)
25+
- [Open Mainframe Summit Replays](https://www.youtube.com/channel/UC-WTXQQtz2m5iTflJLK59aw/videos)
26+
- [SHARE Replays (for purchase)](https://event.share.org/home)
27+
28+
#### Next Meeting
29+
Tues, Nov 10th 8 a.m PST / 11 a.m EST
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Meeting Agenda:
2+
### Tues, Sept 8th 8:00 a.m PST / 11:00 a.m EST 
3+
4+
- TSC Members Introductions - All
5+
- Project Update - Sudharsana & Mike
6+
- Db2 Project Update - Paul
7+
- Q&A
8+
9+
## Meeting Minutes:
10+
Attendees: All Core team members & few community participants
11+
12+
1. Core Team members introduced themselves
13+
2. Sudharsana shared a quick update on COBOL Course
14+
- requested community participation in building up content for Course #2
15+
3. Paul shared an update on the Db2 labs
16+
- Raven was on the call and shared the work she has been doing with Paul
17+
4. Q&A
18+
- No questions on this call. It was a fairly short call
19+
20+
#### Next Meeting
21+
Tues, Oct 13th 8 a.m PST / 11 a.m EST

0 commit comments

Comments
 (0)