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 - Learning COBOL/COBOL Programming Course #2 - Learning COBOL.md
+35-3Lines changed: 35 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2823,9 +2823,8 @@ All files are available in your VS Code Zowe Explorer.
2823
2823
### Instructions
2824
2824
2825
2825
1. Open `CBL006A.cobol` from your VS Code Zowe Explorer.
2826
-
2827
2826
This program reads account records and counts how many clients are from `"New York"`.
2828
-
2827
+
2829
2828
2. Submit the JCL job `CBL006AJ.jcl`. View the job output from the JOBS section.
2830
2829
- Confirm that no syntax or runtime errors occurred.
2831
2830
- Now carefully read the final line of the report. `New York Clients = 000`
@@ -2850,7 +2849,7 @@ Ask yourself: *Is this the number of New York clients you expected?*
2850
2849
2851
2850
This chapter aims to introduce the concept of implementing arithmetic expressions in COBOL programs. We will review the basic concept of arithmetic expressions, operators, statements, limitations, statement operands, as well as precedence of operation within the expressions. You will be able to follow along with a comprehensive example exhibiting the usage of arithmetic expressions in a COBOL program that you have seen in previous chapters and labs. Following the chapter is a lab to practice the implementation of what you have learned.
2852
2851
2853
-
2852
+
2854
2853
2855
2854
-**What is an arithmetic expression?**
2856
2855
@@ -3602,6 +3601,39 @@ CPU attempted to divide a number with 0.
3602
3601
- Incorrectly initialized or uninitialized variables
3603
3602
- Missing or incorrect data edits
3604
3603
3604
+
## Lab
3605
+
3606
+
**Handling ABEND S0CB - Division by Zero**
3607
+
3608
+
**Objective:** Learn how to recognize and debug a common ABEND error, S0CB caused by attempting to divide by zero in a COBOL program.
3609
+
3610
+
In COBOL, a division by zero will not result in a warning, it will immediately cause a system ABEND with code S0CB. This kind of error may compile successfully and even run, but will crash at runtime with messages like:
3611
+
3612
+
*`CEE3211S The system detected a decimal-divide exception (System Completion Code=0CB)
3613
+
`*
3614
+
3615
+
### Instructions
3616
+
1. Open the file `CBL0013.cobol`. Look at the line where division occurs:
3617
+
3618
+

3619
+
3620
+
2. In `CBL0013.cobol`, notice that DENOMINATOR is initialized to 0, causing a division-by-zero.
3621
+
3622
+
3. Submit the JCL program: `CBL0013J.jcl`.
3623
+
3624
+
*You should observe the job fails with a S0CB ABEND.*
3625
+
3626
+

3627
+
3628
+
4. Fix the error by modifying DENOMINATOR to a non-zero value like:
3629
+
3630
+
`01 DENOMINATOR PIC 9(04) VALUE 10.
3631
+
`
3632
+
3633
+
5. Save and resubmit the JCL. The program should now complete successfully and display:
3634
+
3635
+

3636
+
3605
3637
### S222/S322 - Time Out / Job Cancelled
3606
3638
3607
3639
When you submit a JCL, it is possible to determine how much time you want to allocate to a job. If the job surpasses that allocated time, it will time out. Depending on how your system is set up, a job that has taken a prolonged time may be canceled either manually by the operator or automatically.
0 commit comments