Skip to content

Commit 569e5b6

Browse files
authored
Merge branch 'master' into fix-137
2 parents 60aa9bc + 9ee98fa commit 569e5b6

File tree

9 files changed

+519
-18
lines changed

9 files changed

+519
-18
lines changed

COBOL Programming Course #1 - Getting Started/COBOL Programming Course #1 - Getting Started.md

Lines changed: 337 additions & 11 deletions
Large diffs are not rendered by default.

COBOL Programming Course #1 - Getting Started/Labs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ Note:
1919

2020
**data** folder
2121
- member **data** must be transferred binary to z/OS because the data contains EBCDIC and Packed Decimal
22-
- member **datax** is a viewable ASCII data but the packed decimal fields were translated to ASCII and are unreadable
22+
- member **xdata** is a viewable ASCII data but the packed decimal fields were translated to ASCII and are unreadable
2323

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
*-----------------------
2+
IDENTIFICATION DIVISION.
3+
*-----------------------
4+
PROGRAM-ID. SRCHBIN.
5+
AUTHOR. Otto B. Boolean.
6+
*--------------------
7+
ENVIRONMENT DIVISION.
8+
*--------------------
9+
INPUT-OUTPUT SECTION.
10+
FILE-CONTROL.
11+
SELECT ACCT-REC ASSIGN TO ACCTREC.
12+
*-------------
13+
DATA DIVISION.
14+
*-------------
15+
FILE SECTION.
16+
FD ACCT-REC RECORDING MODE F.
17+
01 ACCT-FIELDS PIC X(170).
18+
*
19+
WORKING-STORAGE SECTION.
20+
01 FLAGS.
21+
05 LASTREC PIC X VALUE SPACE.
22+
88 END-OF-FILE VALUE 'Y'.
23+
05 TABLE-VAR PIC S9(4) COMP.
24+
05 TABLE-MAX PIC S9(4) COMP VALUE 45.
25+
*
26+
01 ACCT-TABLE.
27+
05 ACCT-TABLE-ITEM OCCURS 45 TIMES ASCENDING KEY IS ACCT-NO
28+
INDEXED BY TABLE-IDX.
29+
10 ACCT-NO PIC X(8).
30+
10 ACCT-LIMIT PIC S9(7)V99 COMP-3.
31+
10 ACCT-BALANCE PIC S9(7)V99 COMP-3.
32+
10 LAST-NAME PIC X(20).
33+
10 FIRST-NAME PIC X(15).
34+
10 CLIENT-ADDR.
35+
15 STREET-ADDR PIC X(25).
36+
15 CITY-COUNTY PIC X(20).
37+
15 USA-STATE PIC X(15).
38+
10 RESERVED PIC X(7).
39+
10 COMMENTS PIC X(50).
40+
*
41+
*------------------
42+
PROCEDURE DIVISION.
43+
*------------------
44+
OPEN-FILES.
45+
OPEN INPUT ACCT-REC.
46+
*
47+
LOAD-TABLES.
48+
PERFORM READ-RECORD.
49+
PERFORM VARYING TABLE-VAR FROM 1 BY 1
50+
UNTIL TABLE-VAR = TABLE-MAX OR END-OF-FILE
51+
MOVE ACCT-FIELDS TO ACCT-TABLE-ITEM (TABLE-VAR)
52+
PERFORM READ-RECORD
53+
END-PERFORM.
54+
*
55+
SEARCH-RECORD.
56+
SET TABLE-IDX TO 1.
57+
SEARCH ALL ACCT-TABLE-ITEM
58+
AT END DISPLAY "Not Found"
59+
WHEN ACCT-NO (TABLE-IDX) = 18011809
60+
DISPLAY "User with Acct No 18011809 is found!".
61+
*
62+
CLOSE-STOP.
63+
CLOSE ACCT-REC.
64+
GOBACK.
65+
*
66+
READ-RECORD.
67+
READ ACCT-REC
68+
AT END MOVE 'Y' TO LASTREC
69+
END-READ.
70+
*
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
*-----------------------
2+
IDENTIFICATION DIVISION.
3+
*-----------------------
4+
PROGRAM-ID. SRCHSER.
5+
AUTHOR. Otto B. Boolean.
6+
*--------------------
7+
ENVIRONMENT DIVISION.
8+
*--------------------
9+
INPUT-OUTPUT SECTION.
10+
FILE-CONTROL.
11+
SELECT ACCT-REC ASSIGN TO ACCTREC.
12+
*-------------
13+
DATA DIVISION.
14+
*-------------
15+
FILE SECTION.
16+
FD ACCT-REC RECORDING MODE F.
17+
01 ACCT-FIELDS PIC X(170).
18+
*
19+
WORKING-STORAGE SECTION.
20+
01 FLAGS.
21+
05 LASTREC PIC X VALUE SPACE.
22+
88 END-OF-FILE VALUE 'Y'.
23+
05 TABLE-VAR PIC S9(4) COMP.
24+
05 TABLE-MAX PIC S9(4) COMP VALUE 45.
25+
*
26+
01 ACCT-TABLE.
27+
05 ACCT-TABLE-ITEM OCCURS 45 TIMES INDEXED BY TABLE-IDX.
28+
10 ACCT-NO PIC X(8).
29+
10 ACCT-LIMIT PIC S9(7)V99 COMP-3.
30+
10 ACCT-BALANCE PIC S9(7)V99 COMP-3.
31+
10 LAST-NAME PIC X(20).
32+
10 FIRST-NAME PIC X(15).
33+
10 CLIENT-ADDR.
34+
15 STREET-ADDR PIC X(25).
35+
15 CITY-COUNTY PIC X(20).
36+
15 USA-STATE PIC X(15).
37+
10 RESERVED PIC X(7).
38+
10 COMMENTS PIC X(50).
39+
*
40+
*------------------
41+
PROCEDURE DIVISION.
42+
*------------------
43+
OPEN-FILES.
44+
OPEN INPUT ACCT-REC.
45+
*
46+
LOAD-TABLES.
47+
PERFORM READ-RECORD.
48+
PERFORM VARYING TABLE-VAR FROM 1 BY 1
49+
UNTIL TABLE-VAR = TABLE-MAX OR END-OF-FILE
50+
MOVE ACCT-FIELDS TO ACCT-TABLE-ITEM (TABLE-VAR)
51+
PERFORM READ-RECORD
52+
END-PERFORM.
53+
*
54+
SEARCH-RECORD.
55+
SET TABLE-IDX TO 1.
56+
SEARCH ACCT-TABLE-ITEM VARYING TABLE-IDX
57+
AT END DISPLAY "Not Found"
58+
WHEN LAST-NAME (TABLE-IDX) = "ROOSEVELT"
59+
DISPLAY "Roosevelt is found!".
60+
*
61+
CLOSE-STOP.
62+
CLOSE ACCT-REC.
63+
GOBACK.
64+
*
65+
READ-RECORD.
66+
READ ACCT-REC
67+
AT END MOVE 'Y' TO LASTREC
68+
END-READ.
69+
*
0 Bytes
Binary file not shown.
44 Bytes
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//SRCHBINJ JOB 1,NOTIFY=&SYSUID
2+
//***************************************************/
3+
//COBRUN EXEC IGYWCL
4+
//COBOL.SYSIN DD DSN=&SYSUID..CBL(SRCHBIN),DISP=SHR
5+
//LKED.SYSLMOD DD DSN=&SYSUID..LOAD(SRCHBIN),DISP=SHR
6+
//***************************************************/
7+
// IF RC = 0 THEN
8+
//***************************************************/
9+
//RUN EXEC PGM=SRCHBIN
10+
//STEPLIB DD DSN=&SYSUID..LOAD,DISP=SHR
11+
//ACCTREC DD DSN=&SYSUID..DATA,DISP=SHR
12+
//PRTLINE DD SYSOUT=*,OUTLIM=15000
13+
//SYSOUT DD SYSOUT=*,OUTLIM=15000
14+
//CEEDUMP DD DUMMY
15+
//SYSUDUMP DD DUMMY
16+
//***************************************************/
17+
// ELSE
18+
// ENDIF
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//SRCHSERJ JOB 1,NOTIFY=&SYSUID
2+
//***************************************************/
3+
//COBRUN EXEC IGYWCL
4+
//COBOL.SYSIN DD DSN=&SYSUID..CBL(SRCHSER),DISP=SHR
5+
//LKED.SYSLMOD DD DSN=&SYSUID..LOAD(SRCHSER),DISP=SHR
6+
//***************************************************/
7+
// IF RC = 0 THEN
8+
//***************************************************/
9+
//RUN EXEC PGM=SRCHSER
10+
//STEPLIB DD DSN=&SYSUID..LOAD,DISP=SHR
11+
//ACCTREC DD DSN=&SYSUID..DATA,DISP=SHR
12+
//PRTLINE DD SYSOUT=*,OUTLIM=15000
13+
//SYSOUT DD SYSOUT=*,OUTLIM=15000
14+
//CEEDUMP DD DUMMY
15+
//SYSUDUMP DD DUMMY
16+
//***************************************************/
17+
// ELSE
18+
// ENDIF

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ Three ‘Enterprise COBOL for z/OS” manuals are referenced throughout the chap
4848

4949
- What’s New in Enterprise COBOL for z/OS V6.1:
5050

51-
[https://youtu.be/N_Zsd1W8hWc](https://youtu.be/N_Zsd1W8hWc)
51+
[https://www.ibm.com/support/pages/cobol-v61-was-announced-whats-new](https://www.ibm.com/support/pages/cobol-v61-was-announced-whats-new)
5252

5353
- What’s New in Enterprise COBOL for z/OS V6.2:
5454

55-
[https://youtu.be/H0iweEbVNFs](https://youtu.be/H0iweEbVNFs)
55+
[https://www.ibm.com/support/pages/cobol-v62-was-announced-whats-new](https://www.ibm.com/support/pages/cobol-v62-was-announced-whats-new)
5656

5757
- What’s New in Enterprise COBOL for z/OS V6.3:
5858

59-
[https://youtu.be/bRLKGeB6W2A](https://youtu.be/bRLKGeB6W2A)
59+
[https://www.ibm.com/support/pages/cobol-v63-was-announced-whats-new](https://www.ibm.com/support/pages/cobol-v63-was-announced-whats-new)
6060

6161
\newpage
6262
# Numerical Data Representation
@@ -750,7 +750,7 @@ We will explore the popular Hacker News website for this challenge. Hacker News
750750
The site offers a dynamic list of posts/stories, submitted by users, each of which could be expanded into its own unique comment thread. Readers can upvote or downvote links and comments, and the top thirty links are featured on the front page. Today, more than five million people read Hacker News each month, and landing a blog post on the front page is a badge of honor for many technologists.
751751
752752
### Our Goal
753-
We will be working on a Hacker News 2015-2016 dataset from Kaggle with a full year’s worth of stories: Our goal is to extract only the Mainframe/COBOL related stories and assign ranking scores to them based on (a simplified version) the published Hacker News ranking algorithm. We will create a front page report that reflects this ranking order. The algorithm works in a way that nothing stays on the front page for too long, so a story’s score will eventually drop to zero over time (the gravity effect). Since our posts are spread out over a year and as older posts will always have a lower (or zero) ranking, we will distort the data so all our stories have the same date and and consider only the times in the ranking score calculation. This will give all our posts a fair chance of landing the front page. Our front page report is published at 11:59pm. [Here's some additional information on the ranking.](http://www.righto.com/2013/11/how-hacker-news-ranking-really-works.html)
753+
We will be working on a Hacker News 2015-2016 dataset from Kaggle with a full year’s worth of stories: Our goal is to extract only the Mainframe/COBOL related stories and assign ranking scores to them based on (a simplified version) the published Hacker News ranking algorithm. We will create a front page report that reflects this ranking order. The algorithm works in a way that nothing stays on the front page for too long, so a story’s score will eventually drop to zero over time (the gravity effect). Since our posts are spread out over a year and as older posts will always have a lower (or zero) ranking, we will distort the data so all our stories have the same date and and consider only the times in the ranking score calculation. This will give all our posts a fair chance of landing the front page. Our front page report is published at 11:59pm. [Here's some additional information on the ranking.](https://www.righto.com/2013/11/how-hacker-news-ranking-really-works.html)
754754
755755
### The Plan
756756
- There are different creative ways of accomplishing this but here’s our plan: We will have a COBOL program that reads the input CSV file and retrieves only the ***Mainframe/COBOL*** stories. It then calculates the ranking score for the stories by factoring in the time they were posted and the number of votes they received. Each of the records is then written to an output dataset along with the ranking score.
@@ -778,9 +778,9 @@ We will be working on a Hacker News 2015-2016 dataset from Kaggle with a full ye
778778
779779
5. Next add a new step in the JCL member to run the `DFSORT` utility on the output dataset from the previous step. The sort should be done on the ranking score field, from highest to lowest. Use `DFSORT` to also print headers for our front page. As this is a new utility not covered in the course, please check out these links to explore this very powerful and versatile tool:
780780
781-
[Getting started with DFSORT](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.iceg200/abstract.htm)
781+
[Getting started with DFSORT](https://www.ibm.com/docs/en/zos/2.4.0?topic=dfsort-zos-getting-started)
782782
783-
[Example with DFSORT](https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.icea100/ice2ca_Example_10._Sort_with_OUTFIL.htm)
783+
[Example with DFSORT](https://www.ibm.com/docs/en/zos/2.4.0?topic=examples-example-10-sort-outfil)
784784
785785
786786
6. Run and debug until the front page looks ready! Which posts ranked among the highest? Here's a look at the generated report:

0 commit comments

Comments
 (0)