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 with VSCode.md
+287Lines changed: 287 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -460,6 +460,293 @@ As both a user and programmatic interface, command line interfaces offer signifi
460
460
461
461
\newpage
462
462
463
+
# VS Code with Code4z Open-Source Extension Package
464
+
465
+
This section introduces the Code4z extension package, in particular the Zowe Explorer and COBOL Language Support extensions.
466
+
467
+
-**What is Code4z?**
468
+
-**Installation**
469
+
-**COBOL Language Support**
470
+
-**Known File Extensions**
471
+
-**Syntax Highlighting and Coloring**
472
+
-**Syntax and Semantic Check**
473
+
-**Navigation of Code**
474
+
- **Breadcrumb View**
475
+
- **Outline View**
476
+
- **Shortcuts**
477
+
- **Go To Definition**
478
+
- **Find All References**
479
+
-**Copybook Support**
480
+
-**Autocomplete**
481
+
-**Zowe Explorer**
482
+
-**Profiles in Zowe Explorer**
483
+
- **Secure Credentials**
484
+
- **Creating a New Profile**
485
+
- **Editing Profiles**
486
+
- **Deleting Profiles**
487
+
-**Using Zowe Explorer**
488
+
489
+
## What is Code4z?
490
+
491
+
Code4z is an all-in-one, open-source mainframe extension package for Visual Studio Code. The Code4z package contains extensions which provide language support for COBOL and High Level Assembler language, as well as tools which enable developers to access mainframe data sets and CA Endevor code repositories using the Visual Studio Code interface. This guide focuses on the COBOL Language Support extension as well as Zowe Explorer, which lets you access data sets from the Mainframe.
492
+
493
+
The COBOL Language Support extension leverages the Language Server Protocol to provide autocomplete, highlighting, and diagnostic features. Together with Zowe Explorer, you can load COBOL code from a mainframe data set, and edit it leveraging the LSP features of the extension. Once you finish editing, you can save the file back on the mainframe, and store a copy locally.
494
+
495
+
## Installation
496
+
497
+
You can install Code4z by searching the Extensions Marketplace inside VS Code for "Code4z" and selecting install. Once installed, the Zowe Explorer tab is added to the VS Code interface, along with several others, and COBOL Language Support features will be enabled when opening any file with the correct extension identifying it as a COBOL file.
498
+
499
+
## COBOL Language Support
500
+
501
+
The COBOL Language Support extension leverages the Language Server Protocol to provide autocomplete, highlighting, and diagnostic features for COBOL code.
502
+
503
+
### Known File Extensions
504
+
505
+
COBOL Language Support recognises files with the extension .COB and .CBL as COBOL files. This applies to both local files and files held in a PDS on the mainframe.
506
+
507
+
### Syntax Highlighting and Coloring
508
+
509
+
The COBOL Language Support extension uses a third-party plugin to color keywords, paragraphs, and variables in different colors to make the code easier to navigate. The Code4z package contains the bitlang plugin which enables syntax coloring.
510
+
511
+
### Syntax and Semantic Check
512
+
513
+
The extension checks for mistakes and errors in COBOL code. The syntax check feature reviews the whole content of the code, highlights errors and suggests fixes.
514
+
515
+

516
+
517
+
### Navigation of Code
518
+
519
+
The COBOL Language Support extension includes several features for ease of navigation through code.
520
+
521
+
#### Breadcrumb View
522
+
523
+
The breadcrumb view across the top of the editor shows where the current line of code exists within the structure of the COBOL source code. You can click each element on the bar to see that section of the code highlighted, or to select a code element within the section and navigate to it.
524
+
525
+

526
+
527
+
#### Outline View
528
+
529
+
The Bitlang extension included in the Code4z package adds the outline view to the sidebar. Outline view enables you to easily navigate through sections and individual variables and paragraphs.
530
+
531
+
#### Shortcuts
532
+
533
+
You can use the following shortcuts to navigate through your code:
534
+
535
+
***CTRL+ALT+,** moves you one section back.
536
+
***CTRL+ALT+.** moves you one section forward.
537
+
***CTRL+ALT+D** takes you to the data division.
538
+
***CTRL+ALT+P** takes you to the procedure division.
539
+
***CTRL+ALT+W** takes you to the working storage section.
540
+
541
+
These commands are also available if you right click anywhere in the code.
542
+
543
+
#### Go To Definition
544
+
545
+
While your cursor is placed on a variable or paragraph name, you can press **F12** or **CTRL+click** to use the **Go To Definition** functionality to display the point in the code where the variable or paragraph is defined.
546
+
547
+

548
+
549
+
#### Find All References
550
+
551
+
The **Find All References** functionality (**SHIFT+ALT+F12**) highlights all references to a variable or paragraph and displays them in a list in the sidebar, so that you can easily navigate between them.
552
+
553
+

554
+
555
+
### Copybook Support
556
+
557
+
Copybooks are pieces of source code stored in separate data sets which are referenced in a program. The COBOL Language Support extension enables you to download all copybooks referenced in your program from the mainframe to a folder on your machine. In order for this feature to work, you need to set up and configure a Zowe CLI `zosmf` profile.
558
+
559
+
The COBOL Language Support extension helps to ensure that copybooks called in the code remain compatible through semantic analysis of keywords, variables, and paragraphs within copybooks, and ensures the consistency of code by defining variables and paragraphs across copybooks. The extension also helps to protect against unwanted errors caused by recursive or missing copybooks.
560
+
561
+
The **Go To Definition** and **Find All References** functionalities are also extended to work for occurrences of variables and paragraphs from copybooks called in the program as well as from the program itself.
562
+
563
+
### Autocomplete
564
+
565
+
The COBOL Language Support extension provides live suggestions while you type for COBOL keywords, as well as variables and paragraphs which are already referenced in the code or in copybooks used by the program.
566
+
567
+

568
+
569
+
## Zowe Explorer
570
+
571
+
The Zowe Explorer extension modernizes the way developers and system administrators interact with z/OS mainframes. Working with data sets and USS files from VSC can be more convenient than using 3270 emulators. The extension provides the following benefits:
572
+
573
+
* Create, modify, rename, copy and upload data sets directly to a z/OS mainframe.
574
+
* Create, modify, rename and upload USS files directly to a z/OS mainframe.
575
+
* Streamlined process to access data sets, USS files and jobs.
576
+
* Create and use Zowe CLI `zosmf` compatible profiles.
577
+
578
+
### Profiles in Zowe Explorer
579
+
580
+
Profiles serve as a point-of-contact for Zowe Explorer and Mainframe. Profiles contain the URL for the API services that you want to connect to, and your credentials. The main profile information that you need for Zowe Explorer is the z/OSMF Connection.
581
+
582
+
#### Secure Credentials
583
+
584
+
Zowe Explorer has a built in Secure Credential Store. This enables you to encrypt the credentials that are stored in your machine, and as a result secure your connection to the Mainframe.
585
+
586
+
To enable this feature, follow these steps:
587
+
588
+
1. Click the **Gear Icon** at the bottom left and select **Settings**
589
+
2. Click **User Settings** > **Extensions** > **Zowe Explorer Settings**
590
+
Look for the **Zowe Security: Credential Key** field
591
+

592
+
3. Put Zowe-Plugin in the text box. This will trigger the Built-in Secure Credential Store.
593
+
594
+
Alternatively, to enable this feature by editing settings.json, hover over the gear icon and click "Copy Setting as JSON".
595
+
You can then paste that to settings.json and update the value to Zowe Plugin.
596
+
597
+

598
+
599
+
Note: If you are using Zowe CLI and you’ve installed the Secure-Credential-Store Plugin, the steps to activate it will still be the same.
600
+
601
+
#### Creating a New Profile
602
+
603
+
Follow these steps:
604
+
605
+
1. Navigate to the Zowe Explorer tree on the right side and look for the + sign
606
+

607
+
608
+
2. Click on the + sign.
609
+
A dialog box will appear and ask if you want to "Create a New Connection to z/OS".
610
+
611
+
3. Press enter or click on that selection.
612
+

613
+
614
+
4. Enter a Profile name in the "Connection Name" field.
615
+

616
+
617
+
5. Enter the URL and Port that you received by email when you registered for the COBOL Course. The connection information that you need has a title of "IP address for VSCode extension".
618
+

619
+
620
+
6. Enter your Username. This is also included in the email.
621
+

622
+
Note: You can leave this blank if you do not want to save your credentials in your machine. You will be prompted for your username once you start using Zowe Explorer.
623
+
624
+
7. Enter your Password.
625
+

626
+
627
+
Note: You can leave this blank if you do not want to save your credentials in your machine. You will be prompted for your username once you start using Zowe Explorer.
628
+
629
+
8. Select True/False if you want to accept or reject Self-Signed Certificates.
630
+

631
+
632
+
If you are successful, you will receive this informational message:
633
+
634
+

635
+
636
+
#### Editing Profiles
637
+
638
+
The Zowe Explorer v1.5.0 release introduces profile editing. This allows you to revise your existing profile information and continue using Zowe Explorer.
639
+
640
+
Follow these steps:
641
+
642
+
1. Add your profile to any of the Zowe Explorer Trees.
643
+
644
+
2. Click on the pencil icon to edit your profile. A dialog box opens displaying the current information in your profile, which you can edit as required.
645
+

646
+
647
+
3. Edit the URL information if changes are required, or enter to confirm the information is still correct.
648
+

649
+
650
+
4. Edit your Username
651
+

652
+
653
+
Note: You can leave this blank if you do not want to save your credentials in your machine. You will be prompted for your username once you start using Zowe Explorer.
654
+
655
+
5. Edit your Password
656
+

657
+
658
+
Note: You can leave this blank if you do not want to save your credentials in your machine. You will be prompted for your username once you start using Zowe Explorer.
659
+
660
+
6. Edit your authorized connections
661
+
662
+
*
663
+
664
+
If you are successful, an information message will appear:
665
+
666
+

667
+
668
+
#### Deleting Profiles
669
+
670
+
The Zowe Explorer v1.5.0 release introduces the option to delete profiles. This allows you to permanently delete unwanted profiles and clean up your files. You can delete profiles either using the command palette or in the tree.
671
+
672
+
Follow these steps:
673
+
674
+
Command Palette:
675
+
676
+
1. Press **CTRL+SHIFT+P** or Click **View** > **Command Palette** to open the Command Palette
677
+
678
+
2. Type "Zowe: Delete". This command allows you to permanently delete a profile.
679
+

680
+
681
+
3. Select the Profile that you want to delete
682
+

683
+
684
+
4. Confirm that you want to delete your profile
685
+
686
+

687
+
688
+
Once confirmed, the following message is displayed:
689
+
690
+

691
+
692
+
Zowe Explorer Tree:
693
+
694
+
1. Right click on the profile and select Delete Profile
695
+

696
+
697
+
2. Confirm that you want to delete your profile
698
+

699
+
700
+
3. Once confirmed, the following message is displayed:
701
+
702
+

703
+
704
+
### Using Zowe Explorer
705
+
706
+
Zowe Explorer allows you to work with data sets, Unix System Service (USS) files, and jobs.
707
+
708
+
Zowe Explorer offers the following functions:
709
+
710
+
Data sets
711
+
712
+
* View data sets and use multiple filters.
713
+
View multiple data sets simultaneously and apply filters to show specific data sets.
714
+
715
+
* Rename data sets
716
+
717
+
* Copy data sets
718
+
719
+
* Download, edit, and upload existing PDS members
720
+
Instantly pull data sets and data set members from the mainframe, edit them and upload back.
721
+
722
+
* Create and delete both data sets and data set members
723
+
724
+
* View, access, and work with multiple profiles simultaneously.
725
+
726
+
* Submit a JCL.
727
+
You can submit a JCL from a chosen data set.
728
+
729
+
USS Files
730
+
731
+
* View multiple Unix System Services (USS) files simultaneously.
732
+
733
+
* Rename USS files.
734
+
735
+
* Download, edit, and upload existing USS files.
736
+
You can instantly pull USS files from the mainframe, edit them and upload back.
737
+
738
+
* Create and delete USS files and directories.
739
+
740
+
* View, access, and work with multiple profiles simultaneously.
741
+
742
+
Jobs:
743
+
744
+
* View multiple jobs simultaneously.
745
+
746
+
* Download spool content onto your computer.
747
+
748
+
For more information about Zowe Explorer and the different use cases, visit the GitHub repository: [https://github.com/zowe/vscode-extension-for-zowe](https://github.com/zowe/vscode-extension-for-zowe)
749
+
463
750
# Installation of VSCode and extensions
464
751
465
752
This chapter covers all aspects of download and installation of Visual Studio (VS) Code and any prerequisites that are needed. It includes:
0 commit comments