Skip to content

Commit 5a710d2

Browse files
authored
Merge branch 'master' into add-more-comments
2 parents 9965b69 + 1b72401 commit 5a710d2

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,56 @@ I hope that by taking this challenge, you will be able to learn something new!
203203
Happy Coding! 😉
204204
205205
_Disclaimer: This challenge is also posted in [Medium.com](https://medium.com/@jessielaine.punongbayan/zowe-cobol-challenge-the-unemployment-claims-2e35a42eabaa)._
206+
207+
\newpage
208+
209+
## Hacker News Rankings for Mainframe/COBOL Posts
210+
211+
![](Images/hacker-img1.png)
212+
213+
We will explore the popular Hacker News website for this challenge. Hacker News is an online community started by Paul Graham for sharing "Anything that good hackers would find interesting. That includes more than hacking and startups".
214+
215+
216+
### A Little Background
217+
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.
218+
219+
### Our Goal
220+
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)
221+
222+
### The Plan
223+
- 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.
224+
225+
- We will then use `DFSORT` to sort the output dataset on ranking score, highest to lowest and display the posts as a simple report mimicking the front page.
226+
227+
Let's get started!
228+
1. Take a look and familiarize yourself with the dataset on z/OS: `ZOS.PUBLIC.HACKER.NEWS`. This is a CSV file that serves as input to your COBOL program. The file was created by downloading [this Kaggle dataset](https://www.kaggle.com/hacker-news/hacker-news-posts), removing the lengthy `URL` column that is of no relevance to us and uploading it to z/OS. You can directly reference this DS in your JCL. Please avoid making a copy as it is fairly large with around 300,000 records.
229+
230+
![](Images/hacker-img2.png)
231+
232+
2. Create your COBOL program in `<userid>.CBL` using VS Code with the Code4z extension installed and enabled – This program will :
233+
1. Read in each record in the input CSV file
234+
2. Select only the records that have mention of the words ***Mainframe*** or ***COBOL*** (ignore case) in the `Title` field
235+
3. Calculate the ranking score for each record based on the number of votes it received and the time it was posted (Ignore date as we assume all posts were created on the same date)
236+
237+
![](Images/hacker-img3.png)
238+
4. Write the record to an output file along with the ranking score
239+
240+
![](Images/hacker-img4.png)
241+
242+
3. Copy/Modify/Create a JCL in `<userid>.JCL` for compiling/linking and running the program against input/output datasets.
243+
244+
4. Submit the job (via `Zowe Explorer` or `Zowe CLI`), debug and test to create the output dataset.
245+
246+
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:
247+
248+
[Getting started with DFSORT](https://www-01.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc236880/$file/iceg200_v2r3.pdf)
249+
250+
[Example with DFSORT](https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/ice2ca_Example_10._Sort_with_OUTFIL.htm)
251+
252+
253+
6. Run and debug until the front page looks ready! Which posts ranked among the highest? Here's a look at the generated report:
254+
255+
![](Images/hacker-img5.png)
256+
257+
258+
Hope you have fun working on this Challenge. Happy COBOL coding!
19.2 KB
Loading
289 KB
Loading
7.93 KB
Loading
53 KB
Loading
129 KB
Loading

0 commit comments

Comments
 (0)