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
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
+

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):
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
+

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):
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
+

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
+

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.
*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):
*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
+

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
+

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
+

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
+

1359
+
1360
+
*Figure 39. `clg` task triggered via button*
1361
+
1210
1362
\newpage
1211
1363
1212
1364
# Data division
@@ -3431,7 +3583,7 @@ This section will cover the necessary steps and information to download and inst
3431
3583
3432
3584
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.
0 commit comments