Skip to content

Commit 88eca4a

Browse files
Merge branch 'master' into master
2 parents b5839d4 + f85fbc3 commit 88eca4a

15 files changed

+183
-6
lines changed

COBOL Programming with VSCode.md

Lines changed: 156 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,10 @@ This chapter introduces the basics of COBOL syntax. It then demonstrates how to
775775

776776
- **Lab**
777777

778+
- **Lab - Zowe CLI & Automation**
779+
- **Zowe CLI - Interactive Usage**
780+
- **Zowe CLI - Programmatic Usage**
781+
778782

779783
## COBOL characteristics
780784

@@ -991,7 +995,7 @@ Three ‘Enterprise COBOL for z/OS” manuals are referenced throughout the chap
991995

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

994-
[https://youtu.be/N_Zsd1W8hWc](https://youtu.be/N_Zsd1W8hWc)``
998+
[https://youtu.be/N_Zsd1W8hWc](https://youtu.be/N_Zsd1W8hWc)
995999

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

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

1214+
## Lab - Zowe CLI & Automation
1215+
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.
1216+
1217+
### Zowe CLI - Interactive Usage
1218+
In this section, we will use the Zowe CLI interactively to view data set members, submit jobs, and review spool output.
1219+
1220+
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.
1221+
1222+
![](Images/zowe-cli-version.png)
1223+
1224+
*Figure 29. `zowe --version` command in VS Code Integrated Terminal (Shell selection outlined in red)*
1225+
1226+
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.
1227+
1228+
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):
1229+
1230+
```
1231+
zowe profiles create zosmf LearnCOBOL --host 192.86.32.250 --port 10433 --ru false --user prompt* --pass prompt*
1232+
```
1233+
1234+
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:
1235+
1236+
```
1237+
zowe profiles set zosmf LearnCOBOL
1238+
```
1239+
1240+
The following figure demonstrates this sequence of commands.
1241+
1242+
![](Images/create-and-set-zosmf-profile.png)
1243+
1244+
*Figure 30. Create and set z/OSMF profile (secure credential store plug-in is in use)*
1245+
1246+
3. Confirm you can connect to z/OSMF by issuing the following command:
1247+
1248+
```
1249+
zowe zosmf check status
1250+
```
1251+
1252+
4. List data sets under your ID by issuing a command similar to (see sample output in the following figure):
1253+
1254+
```
1255+
zowe files list ds "Z80462.*"
1256+
```
1257+
1258+
You can also list all members in a partitioned data set by issuing a command similar to (see sample output in the following figure):
1259+
1260+
```
1261+
zowe files list am "Z80462.CBL"
1262+
```
1263+
1264+
![](Images/zowe-files-list-ds-and-am-commands.png)
1265+
1266+
*Figure 31. zowe files list ds and am commands*
1267+
1268+
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:
1269+
1270+
![](Images/vscode-add-folder.png)
1271+
1272+
*Figure 32. File explorer view to demonstrate opening a new folder*
1273+
1274+
Once you have an empty folder opened, return to the integrated terminal, ensure you are in your folder, and issue commands similar to:
1275+
1276+
```
1277+
zowe files download am "Z80462.CBL" -e ".cbl"
1278+
zowe files download am "Z80462.JCL" -e ".jcl"
1279+
```
1280+
1281+
Then open `hello.cbl` in your file explorer. A completed example is shown in the following figure:
1282+
1283+
![](Images/zowe-files-download-am.png)
1284+
1285+
*Figure 33. Download and view data set members using the CLI*
1286+
1287+
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:
1288+
1289+
```
1290+
zowe jobs submit ds "Z80462.JCL(HELLO)" --vasc
1291+
```
1292+
1293+
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:
1294+
1295+
```
1296+
zowe jobs submit ds "Z80462.JCL(HELLO)" --wfo
1297+
```
1298+
1299+
To list spool files associated with this job id, issue:
1300+
1301+
```
1302+
zowe jobs list sfbj JOB00906
1303+
```
1304+
1305+
where `JOB00906` was returned from the previous command.
1306+
1307+
To view a specific spool file (COBRUN:SYSOUT), issue:
1308+
1309+
```
1310+
zowe jobs view sfbi JOB00906 105
1311+
```
1312+
1313+
where `JOB00906` and `105` are obtained from the previous commands.
1314+
1315+
![](Images/zowe-jobs-submit-ds-and-view-spool-output.png)
1316+
1317+
*Figure 34. Submit a job, wait for it to complete, then list spool files for the job, and view a specific spool file*
1318+
1319+
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):
1320+
1321+
```
1322+
zowe jobs submit ds "Z80462.JCL(HELLO)" -d .
1323+
```
1324+
1325+
![](Images/zowe-jobs-submit-ds-and-download-spool-output.png)
1326+
1327+
*Figure 35. Submit a job, wait for it to complete, download and view spool files*
1328+
1329+
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.
1330+
1331+
![](Images/zowe-jobs-submit-ds-rfj.png)
1332+
1333+
*Figure 36. The `--rfj` flag allows for easy programmatic usage*
1334+
1335+
### Zowe CLI - Programmatic Usage
1336+
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.
1337+
1338+
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.
1339+
1340+
![](Images/npm-init-example.png)
1341+
1342+
*Figure 37. Use of `npm init` to create `package.json` for the project*
1343+
1344+
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):
1345+
1346+
```
1347+
zowe jobs submit ds 'Z80462.JCL(HELLO)' -d .
1348+
```
1349+
1350+
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.
1351+
1352+
![](Images/npm-run-clg.png)
1353+
1354+
*Figure 38. Final `package.json` and `npm run clg` execution*
1355+
1356+
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.
1357+
1358+
![](Images/npm-run-clg-button.png)
1359+
1360+
*Figure 39. `clg` task triggered via button*
1361+
12101362
\newpage
12111363

12121364
# Data division
@@ -3431,7 +3583,7 @@ This section will cover the necessary steps and information to download and inst
34313583

34323584
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.
34333585

3434-
- [https://www.ibm.com/support/pages/node/713257](https://www.ibm.com/support/pages/node/713257)``
3586+
- [https://www.ibm.com/support/pages/node/713257](https://www.ibm.com/support/pages/node/713257)
34353587

34363588

34373589
### Software prerequisites
@@ -3909,8 +4061,7 @@ We've covered, in this chapter, less than 5% of what IDz has to offer for the z/
39094061

39104062
- IBM instructional videos on IDz:
39114063

3912-
[https://developer.ibm.com/mainframe/videos/](https://developer.ibm.com/mainframe/videos/)``
3913-
4064+
[https://developer.ibm.com/mainframe/videos/](https://developer.ibm.com/mainframe/videos/)
39144065

39154066
- Ongoing IBM (free) Remote Instructor-led training on IDz:
39164067

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

43674518
- A link to an excellent instructional video on ISPF:
43684519

4369-
[https://www.youtube.com/watch?v=vOiHiI7b9iY](https://www.youtube.com/watch?v=vOiHiI7b9iY)``
4520+
[https://www.youtube.com/watch?v=vOiHiI7b9iY](https://www.youtube.com/watch?v=vOiHiI7b9iY)
43704521

43714522
\newpage
43724523

COBOL Programming with VSCode.pdf

3.88 MB
Binary file not shown.

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

0 commit comments

Comments
 (0)