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
Copy file name to clipboardExpand all lines: COBOL Programming Course #2 - Learning COBOL/COBOL Programming Course #2 - Learning COBOL.md
+71-77Lines changed: 71 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -422,7 +422,7 @@ In this lab exercise, you will connect to an IBM Z system, view a simple COBOL h
422
422
423
423
5. Now back on your VSCode window, select the Explorer tab, and press the "Open folder" button in the left bar.
424
424
425
-

425
+

426
426
427
427
*Figure 6. Click the open folder button*
428
428
@@ -565,145 +565,139 @@ In this section, we will use the Zowe CLI interactively to view data set members
565
565
566
566
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 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.
567
567
568
-

568
+

569
569
570
-
*Figure 29. `zowe --version` command in VS Code Integrated Terminal (Shell selection outlined in red)*
570
+
*Figure 26. `zowe --version` command in VS Code Integrated Terminal*
571
571
572
-
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.
572
+
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 file.
573
573
574
-
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):
574
+
If you have done the configuration in the first lab, you will have a folder containing your team configuration files. Make sure that your terminal is at that location and issue the following command.
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:
580
+
The following figure demonstrates the outcome of the command.
581
581
582
-
```
583
-
zowe profiles set zosmf LearnCOBOL
584
-
```
582
+

585
583
586
-
The following figure demonstrates this sequence of commands.
587
-
588
-

589
-
590
-
*Figure 30. Create and set z/OSMF profile (secure credential store plug-in is in use)*
584
+
*Figure 27. List available team config connections*
591
585
592
586
3. Confirm you can connect to z/OSMF by issuing the following command:
593
587
594
-
```
595
-
zowe zosmf check status
596
-
```
588
+
```
589
+
zowe zosmf check status
590
+
```
597
591
598
592
4. List data sets under your ID by issuing a command similar to (see sample output in the following figure):
599
593
600
-
```
601
-
zowe files list ds "Z99998.*"
602
-
```
594
+
```
595
+
zowe files list ds "Z99998.*"
596
+
```
603
597
604
-
You can also list all members in a partitioned data set by issuing a command similar to (see sample output in the following figure):
598
+
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:
615
609
616
-

610
+

617
611
618
-
*Figure 32. File explorer view to demonstrate opening a new folder*
612
+
*Figure 29. File explorer view to demonstrate opening a new folder*
619
613
620
-
Once you have an empty folder opened, return to the integrated terminal, ensure you are in your folder, and issue commands similar to:
614
+
Once you have an empty folder opened, return to the integrated terminal, ensure you are in your folder, and issue commands similar to:
621
615
622
-
```
623
-
zowe files download am "Z99998.CBL" -e ".cbl"
624
-
zowe files download am "Z99998.JCL" -e ".jcl"
625
-
```
616
+
```
617
+
zowe files download am "Z99998.CBL" -e ".cbl"
618
+
zowe files download am "Z99998.JCL" -e ".jcl"
619
+
```
626
620
627
-
Then open `hello.cbl` in your file explorer. A completed example is shown in the following figure:
621
+
Then open `hello.cbl` in your file explorer. A completed example is shown in the following figure:
628
622
629
-

623
+

630
624
631
-
*Figure 33. Download and view data set members using the CLI*
625
+
*Figure 30. Download and view data set members using the CLI*
632
626
633
627
6. Next, we will submit the job in member `Z99998.JCL(HELLO)`. To submit the job, wait for it to complete, and view all spool content, issue:
634
628
635
-
```
636
-
zowe jobs submit ds "Z99998.JCL(HELLO)" --vasc
637
-
```
629
+
```
630
+
zowe jobs submit ds "Z99998.JCL(HELLO)" --vasc
631
+
```
638
632
639
-
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:
633
+
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:
640
634
641
-
```
642
-
zowe jobs submit ds "Z99998.JCL(HELLO)" --wfo
643
-
```
635
+
```
636
+
zowe jobs submit ds "Z99998.JCL(HELLO)" --wfo
637
+
```
644
638
645
-
To list spool files associated with this job id, issue:
639
+
To list spool files associated with this job id, issue:
646
640
647
-
```
648
-
zowe jobs list sfbj JOB09413
649
-
```
641
+
```
642
+
zowe jobs list sfbj JOB09413
643
+
```
650
644
651
-
where `JOB09413` was returned from the previous command.
645
+
where `JOB09413` was returned from the previous command.
652
646
653
-
To view a specific spool file (COBRUN:SYSOUT), issue:
647
+
To view a specific spool file (COBRUN:SYSOUT), issue:
654
648
655
-
```
656
-
zowe jobs view sfbi JOB09413 104
657
-
```
649
+
```
650
+
zowe jobs view sfbi JOB09413 104
651
+
```
658
652
659
-
where `JOB09413` and `104` are obtained from the previous commands.
653
+
where `JOB09413` and `104` 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*
657
+
*Figure 31. Submit a job, wait for it to complete, then list spool files for the job, and view a specific spool file*
664
658
665
-
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):
659
+
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*
667
+
*Figure 32. Submit a job, wait for it to complete, download and view spool files*
674
668
675
-
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.
669
+
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.
676
670
677
-

671
+

678
672
679
-
*Figure 36. The `--rfj` flag allows for easy programmatic usage*
673
+
*Figure 33. The `--rfj` flag allows for easy programmatic usage*
680
674
681
675
### Zowe CLI - Programmatic Usage
682
676
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, CLIST, etc. for automation, but today we are going to use CLI and distributed tooling.
683
677
684
678
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.
685
679
686
-

680
+

687
681
688
-
*Figure 37. Use of `npm init` to create `package.json` for the project*
682
+
*Figure 34. Use of `npm init` to create `package.json` for the project*
689
683
690
684
2. Now that we have our `package.json` simply replace the `test` script with a `clg` script that runs the following zowe command (replace `Z99998` with your high-level qualifier):
691
685
692
-
```
693
-
zowe jobs submit ds 'Z99998.JCL(HELLO)' -d .
694
-
```
686
+
```
687
+
zowe jobs submit ds 'Z99998.JCL(HELLO)' -d .
688
+
```
695
689
696
-
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.
690
+
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.
697
691
698
-

692
+

699
693
700
-
*Figure 38. Final `package.json` and `npm run clg` execution*
694
+
*Figure 35. Final `package.json` and `npm run clg` execution*
701
695
702
696
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 accommodate more complex scenarios.
0 commit comments