Skip to content

Commit 412d72c

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 205d8a7 + 0dae3de commit 412d72c

15 files changed

+187
-7
lines changed

COBOL Programming with VSCode.md

Lines changed: 159 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,8 @@ Open VSCode and in the left side tool menu select **Extensions**. From there, i
911911

912912
*Figure 3. Install Zowe Explorer in VSCode*
913913

914+
The Zowe communinity have a number of on-line video that walk through the steps required to install, configure and operate the Zowe Explorer, see [Zowe Explorer VSC Extension (part 1)](http://www.youtube.com/watch?v=G_WCsFZIWt4&t=0m38s).
915+
914916
### IBM Z Open Editor
915917

916918
IBM Z Open Editor brings COBOL and PL/I language support to Microsoft VSCode. It is one of the several next generation capabilities for an open development experience for z/OS®. It also works in association with the Zowe Explorer plugin. For more information on IBM Z Open Editor, please visit:
@@ -1106,6 +1108,10 @@ This chapter introduces the basics of COBOL syntax. It then demonstrates how to
11061108

11071109
- **Lab**
11081110

1111+
- **Lab - Zowe CLI & Automation**
1112+
- **Zowe CLI - Interactive Usage**
1113+
- **Zowe CLI - Programmatic Usage**
1114+
11091115

11101116
## COBOL characteristics
11111117

@@ -1322,7 +1328,7 @@ Three ‘Enterprise COBOL for z/OS” manuals are referenced throughout the chap
13221328

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

1325-
[https://youtu.be/N_Zsd1W8hWc](https://youtu.be/N_Zsd1W8hWc)``
1331+
[https://youtu.be/N_Zsd1W8hWc](https://youtu.be/N_Zsd1W8hWc)
13261332

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

@@ -1538,6 +1544,154 @@ In this lab exercise you will connect to an IBM Z system, view a simple COBOL he
15381544
28. The following URL is another excellent document describing the above VSCode and Zowe Explore details with examples:
15391545
[https://marketplace.visualstudio.com/items?itemName=Zowe.vscode-extension-for-zowe](https://marketplace.visualstudio.com/items?itemName=Zowe.vscode-extension-for-zowe)
15401546

1547+
## Lab - Zowe CLI & Automation
1548+
In this lab exercise you will use the Zowe CLI to automate submitting the JCL to compile, link, and run the COBOL program and downloading the spool output. Refer to the section on the "Installation of Zowe CLI and Plug-ins" to install Zowe CLI if you have not already done so. Before developing the automation, we will first leverage the Zowe CLI interactively.
1549+
1550+
### Zowe CLI - Interactive Usage
1551+
In this section, we will use the Zowe CLI interactively to view data set members, submit jobs, and review spool output.
1552+
1553+
1. Within VS Code, open the integrated terminal (Terminal -> New Terminal). In the terminal, issue `zowe --version` to confirm the Zowe CLI is installed as depicted in the following figure. If it is not installed, please refer to to the section on the "Installation of Zowe CLI and Plug-ins." Also notice that the default shell selected (outlined in red) is `bash`. I would recommend selecting the default shell as either `bash` or `cmd` for this lab.
1554+
1555+
![](Images/zowe-cli-version.png)
1556+
1557+
*Figure 29. `zowe --version` command in VS Code Integrated Terminal (Shell selection outlined in red)*
1558+
1559+
2. In order for Zowe CLI to interact with z/OSMF the CLI must know the connection details such as host, port, username, password, etc. While you could enter this information on each command, Zowe provides the ability to store this information in configurations commonly known as profiles. Zowe CLI and the Zowe VS Code Extension share profiles. So if you created a connection profile in the first lab, you could naturally leverage it here.
1560+
1561+
To create a LearnCOBOL profile (and overwrite it if it already exists), issue the following command with your system details (using `prompt*` will prompt you for certain fields and not show input):
1562+
1563+
```
1564+
zowe profiles create zosmf LearnCOBOL --host 192.86.32.250 --port 10433 --ru false --user prompt* --pass prompt*
1565+
```
1566+
1567+
Many profiles can be created for interacting with different z/OSMF instances. If this was not your first profile, you will want to set it as the default for the following lab exercises. Issue the following command:
1568+
1569+
```
1570+
zowe profiles set zosmf LearnCOBOL
1571+
```
1572+
1573+
The following figure demonstrates this sequence of commands.
1574+
1575+
![](Images/create-and-set-zosmf-profile.png)
1576+
1577+
*Figure 30. Create and set z/OSMF profile (secure credential store plug-in is in use)*
1578+
1579+
3. Confirm you can connect to z/OSMF by issuing the following command:
1580+
1581+
```
1582+
zowe zosmf check status
1583+
```
1584+
1585+
4. List data sets under your ID by issuing a command similar to (see sample output in the following figure):
1586+
1587+
```
1588+
zowe files list ds "Z80462.*"
1589+
```
1590+
1591+
You can also list all members in a partitioned data set by issuing a command similar to (see sample output in the following figure):
1592+
1593+
```
1594+
zowe files list am "Z80462.CBL"
1595+
```
1596+
1597+
![](Images/zowe-files-list-ds-and-am-commands.png)
1598+
1599+
*Figure 31. zowe files list ds and am commands*
1600+
1601+
5. Next, we will download our COBOL and JCL data set members to our local machine. First, create and open a new folder in your file explorer. Note that you could also create a workspace to manage multiple projects. See the following figure for help:
1602+
1603+
![](Images/vscode-add-folder.png)
1604+
1605+
*Figure 32. File explorer view to demonstrate opening a new folder*
1606+
1607+
Once you have an empty folder opened, return to the integrated terminal, ensure you are in your folder, and issue commands similar to:
1608+
1609+
```
1610+
zowe files download am "Z80462.CBL" -e ".cbl"
1611+
zowe files download am "Z80462.JCL" -e ".jcl"
1612+
```
1613+
1614+
Then open `hello.cbl` in your file explorer. A completed example is shown in the following figure:
1615+
1616+
![](Images/zowe-files-download-am.png)
1617+
1618+
*Figure 33. Download and view data set members using the CLI*
1619+
1620+
6. Next, we will submit the job in member `Z80462.JCL(HELLO)`. To submit the job, wait for it to complete, and view all spool content, issue:
1621+
1622+
```
1623+
zowe jobs submit ds "Z80462.JCL(HELLO)" --vasc
1624+
```
1625+
1626+
We could also perform this step in piecemeal to get the output from a specific spool file. See the next figure for an example of the upcoming commands. To submit the job and wait for it to enter OUTPUT status, issue:
1627+
1628+
```
1629+
zowe jobs submit ds "Z80462.JCL(HELLO)" --wfo
1630+
```
1631+
1632+
To list spool files associated with this job id, issue:
1633+
1634+
```
1635+
zowe jobs list sfbj JOB00906
1636+
```
1637+
1638+
where `JOB00906` was returned from the previous command.
1639+
1640+
To view a specific spool file (COBRUN:SYSOUT), issue:
1641+
1642+
```
1643+
zowe jobs view sfbi JOB00906 105
1644+
```
1645+
1646+
where `JOB00906` and `105` are obtained from the previous commands.
1647+
1648+
![](Images/zowe-jobs-submit-ds-and-view-spool-output.png)
1649+
1650+
*Figure 34. Submit a job, wait for it to complete, then list spool files for the job, and view a specific spool file*
1651+
1652+
If desired, you can also easily submit a job, wait for it to complete, and download the spool content using the following command (see the following figure for the completed state):
1653+
1654+
```
1655+
zowe jobs submit ds "Z80462.JCL(HELLO)" -d .
1656+
```
1657+
1658+
![](Images/zowe-jobs-submit-ds-and-download-spool-output.png)
1659+
1660+
*Figure 35. Submit a job, wait for it to complete, download and view spool files*
1661+
1662+
The Zowe CLI was built with scripting in mind. For example, you can use the `--rfj` flag to receive output in JSON format for easy parsing. See the next figure for an example.
1663+
1664+
![](Images/zowe-jobs-submit-ds-rfj.png)
1665+
1666+
*Figure 36. The `--rfj` flag allows for easy programmatic usage*
1667+
1668+
### Zowe CLI - Programmatic Usage
1669+
In this section, we will leverage the Zowe CLI programmatically to automate submitting the JCL to compile, link, and run the COBOL program and downloading the spool output. Once you have the content locally you could use any number of distributed scripting and testing tools to eliminate the need to manually review the spool content itself. Historically, in Mainframe we use REXX EXEC etc. for automation, but today we are going to use CLI and distributed tooling.
1670+
1671+
1. Since we already have Node and npm installed, let’s just create a node project for our automation. To initialize a project, issue `npm init` in your project’s folder and follow the prompts. You can accept the defaults by just pressing enter. Only the description and author fields should be changed. See the following figure.
1672+
1673+
![](Images/npm-init-example.png)
1674+
1675+
*Figure 37. Use of `npm init` to create `package.json` for the project*
1676+
1677+
2. Now that we have our `package.json` simply replace the `test` script with a `clg` script that runs the following zowe command (replace `Z80462` with your high level qualifier):
1678+
1679+
```
1680+
zowe jobs submit ds 'Z80462.JCL(HELLO)' -d .
1681+
```
1682+
1683+
You can name the script whatever you want. I only suggested `clg` because the `CLG` in the `IGYWCLG` proc (which is what the JCL leverages) stands for compile, link, go. Now, simply issue `npm run clg` in your terminal to leverage the automation to compile, link and run the COBOL program and download the output for review. An example of the completed `package.json` and command execution are shown in the following figure.
1684+
1685+
![](Images/npm-run-clg.png)
1686+
1687+
*Figure 38. Final `package.json` and `npm run clg` execution*
1688+
1689+
3. If you prefer a graphical trigger, you can leverage VS Code as shown in the following figure. Essentially, the CLI enables you to quickly build your own buttons for your custom z/OS tasks. You could also invoke a script rather than a single command to accomodate more complex scenarios.
1690+
1691+
![](Images/npm-run-clg-button.png)
1692+
1693+
*Figure 39. `clg` task triggered via button*
1694+
15411695
\newpage
15421696

15431697
# Data division
@@ -2528,7 +2682,7 @@ This may seem complex, but compare it to this Java pseudo-code:
25282682

25292683
```
25302684
for(int counter = 0; counter < 11; counter++){
2531-
for(int counter-2 = 0; counter < 5; counter++{
2685+
for(int counter2 = 0; counter2 < 5; counter2++{
25322686
//move counter to msg-to-write
25332687
//write print-rec
25342688
}
@@ -3762,7 +3916,7 @@ This section will cover the necessary steps and information to download and inst
37623916

37633917
From the link below, you will find the requirements for installing and running IDz on the different supported OS platforms: Windows, Linux, Mac and z/OS. Select your proper platform and verify that your system meets the operating systems and hardware minimum requirements.
37643918

3765-
- [https://www.ibm.com/support/pages/node/713257](https://www.ibm.com/support/pages/node/713257)``
3919+
- [https://www.ibm.com/support/pages/node/713257](https://www.ibm.com/support/pages/node/713257)
37663920

37673921

37683922
### Software prerequisites
@@ -4240,8 +4394,7 @@ We've covered, in this chapter, less than 5% of what IDz has to offer for the z/
42404394

42414395
- IBM instructional videos on IDz:
42424396

4243-
[https://developer.ibm.com/mainframe/videos/](https://developer.ibm.com/mainframe/videos/)``
4244-
4397+
[https://developer.ibm.com/mainframe/videos/](https://developer.ibm.com/mainframe/videos/)
42454398

42464399
- Ongoing IBM (free) Remote Instructor-led training on IDz:
42474400

@@ -4697,7 +4850,7 @@ We've covered in this chapter less than 5% of what ISPF offers for the z/OS prof
46974850

46984851
- A link to an excellent instructional video on ISPF:
46994852

4700-
[https://www.youtube.com/watch?v=vOiHiI7b9iY](https://www.youtube.com/watch?v=vOiHiI7b9iY)``
4853+
[https://www.youtube.com/watch?v=vOiHiI7b9iY](https://www.youtube.com/watch?v=vOiHiI7b9iY)
47014854

47024855
\newpage
47034856

COMMITTERS.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Sudharsana Srinivasan,[email protected],Sudharsana-Srinivasan
33
Martin Keen,[email protected],martinkeen
44
John Mertic,[email protected],jmertic
55
Paul Newton,[email protected],paulnewt
6+
Michael Bauer,[email protected],MikeBauerCA
704 KB
Loading

Images/npm-init-example.png

657 KB
Loading

Images/npm-run-clg-button.png

267 KB
Loading

Images/npm-run-clg.png

481 KB
Loading

Images/vscode-add-folder.png

108 KB
Loading

Images/zowe-cli-version.png

280 KB
Loading

Images/zowe-files-download-am.png

762 KB
Loading
293 KB
Loading

0 commit comments

Comments
 (0)