Skip to content

Commit

Permalink
Added multi-root sample
Browse files Browse the repository at this point in the history
  • Loading branch information
phaumer committed Aug 4, 2022
1 parent 8f3b325 commit d88b4c2
Show file tree
Hide file tree
Showing 10 changed files with 919 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ After you successfully run the programs, you can see the resulting new files of

In looking at the files, you will notice a new copybook called `SAM2PARM`, which was created to contain the parameters necessary for `SAM1.cbl` to pass to `SAM2.cbl` in order to process a new transaction type. There is also a new `TRANFILE` which contains a record for the new `CRUNCH` transaction.

### Multi-root example

The COBOL sample above shows how to use VS Code as a single-root workspace. You also find the folder called [multiroot](./multiroot) in this repository that contains a simple example for how to utilize IBM Z Open Editor with a [VS Code multi-roor workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) setup. See the [README](./multiroot/README.md) in that folder for more details.

## Running PL/I sample files

### Sample files
Expand Down
15 changes: 15 additions & 0 deletions multiroot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Multi-root VS Code workspace example

This folder contains an example for a [VS Code multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) demonstrating how it can be utilized for IBM Z Open Editor for ZAPP and IBM User Build. For the extended User Build example switch to the branch `wazi-main`. The branch `main` will only cover ZAPP.

## Opening the multi-root workspace

See the [VS Code documentation](https://code.visualstudio.com/docs/editor/multi-root-workspaces) for more details about how multi-root workspaces are used. To open this example, use the VS Code menu **File > Open Workspace from File...** and select the file [multiroot/workspace/sam.code-workspace](./workspace/sam.code-workspace). VS Code will reload itself and now show the folders that make up the multi-root workspace comrpising of the `copybooks`, `sam`, and `workspace` folders. Each of these has been configured to be its own individual workspace. They could have been distributed to all kinds of other folders on your system, each having their own Git repository, but we kept here in one hierarchy to provide them as an easy to install example in our [https://github.com/IBM/zopeneditor-sample](https://github.com/IBM/zopeneditor-sample) GitHub repository.

## Reviewing the workspaces

Expand the workspace folder `sam` and open the file [SAM1.cbl](./sam/SAM1.cbl). You see that Z Open Editor resolves the copybooks included in (around) lines 65, 71 and 75 although the `sam` workspace does not include any copybooks.

Open and examine the [zapp.yaml](./sam/zapp.yaml) file in `sam` ([See here](https://ibm.github.io/zopeneditor-about/Docs/zapp.html#zapp-use-cases) to learn more about ZAPP). You see that it specifies a property-group with the name `sam-local` with the two `syslib` entries `cust` and `trans`. These folders are located in a different workspace as you find them in the [copybooks](./copybooks) workspace folder. Z Open Editor will look in all workspaces of the multi-root workspace for these folders relative to the workspace root folder as specified in the [sam.code-workspace](./workspace/sam.code-workspace) file.

It is possible to have multiple ZAPP files in your multi-root workspaces. They must be in the root folder of each workspace. Z Open Editor will combine all the property-groups it finds in all of these ZAPP files and try to resolve them. The order will somewhat arbitrary, but can be described as the workspace folder first and then the other workspaces in alphabetical order of their path names. We recommend to keep ZAPP files in the workspace of the application programs for which they are used for.
53 changes: 53 additions & 0 deletions multiroot/copybooks/cust/CUSTCOPY.cpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
****************************************************************
* LICENSED MATERIALS - PROPERTY OF IBM
* "RESTRICTED MATERIALS OF IBM"
* (C) COPYRIGHT IBM CORPORATION 2022. ALL RIGHTS RESERVED
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION,
* OR DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE
* CONTRACT WITH IBM CORPORATION
***++++++++++++++++++++++++++++++++++++++++++++++++++++
*
* THE SAMPLE DATA DESCRIBED BY THIS COPY BOOK
* IS <USERID>.ADLAB.CUSTFILE
*
* xxxxxxx
* The following File Manager OPTION:
* 6. COBOL compiler specifications
* must be set-up for this copybook version to work.
* See the example below:
*
* COBOL REPLACE OPTIONS:
* FROM STRING TO STRING
* 1. ==:TAG:== BY ==LAB==
*
*** +++++++++++++++++++++++++++++++++++++++++++++++++++
01 :TAG:-REC.
05 :TAG:-KEY.
10 :TAG:-ID PIC X(5).
10 :TAG:-REC-TYPE PIC X.
05 :TAG:-NAME PIC X(17).
*****05 :TAG:-ACCT-BALANCE PIC S9(7)V99 COMP-3.
05 :TAG:-ACCT-BALANCE PIC 9(7)V99.
*****05 :TAG:-ORDERS-YTD PIC S9(5) COMP.
05 :TAG:-ORDERS-YTD PIC 9(5).
05 :TAG:-ADDR PIC X(20).
05 :TAG:-CITY PIC X(14).
05 :TAG:-STATE PIC X(02).
05 :TAG:-COUNTRY PIC X(11).
*****05 :TAG:-MONTH PIC S9(7)V99 COMP-3 OCCURS 12.
05 :TAG:-MONTH PIC 9(7)V99 OCCURS 12.
05 :TAG:-OCCUPATION PIC X(30).
05 :TAG:-NOTES PIC X(120).
05 :TAG:-DATA-1 PIC X(05).
05 :TAG:-DATA-2 PIC X(40).
01 :TAG:-CONTACT-REC.
05 :TAG:-CONTACT-KEY.
10 :TAG:-CONTACT-ID PIC X(5).
10 :TAG:-CONTACT-REC-TYPE PIC X.
05 :TAG:-CONTACT-NAME PIC X(17).
05 :TAG:-DESCRIPTION PIC X(10).
05 :TAG:-CONTACT-INFO PIC X(20).
05 :TAG:-DATA-3 PIC X(05).
05 :TAG:-DATA-4 PIC X(05).
05 :TAG:-DATA-5 PIC X(05).
05 :TAG:-DATA-6 PIC X.
11 changes: 11 additions & 0 deletions multiroot/copybooks/trans/SAM2PAR5.cpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
****************************************************************
* LICENSED MATERIALS - PROPERTY OF IBM
* "RESTRICTED MATERIALS OF IBM"
* (C) COPYRIGHT IBM CORPORATION 2018. ALL RIGHTS RESERVED
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION,
* OR DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE
* CONTRACT WITH IBM CORPORATION
****************************************************************

05 FILLER PIC X.
05 CRUNCH-AVG PIC 9(16).
12 changes: 12 additions & 0 deletions multiroot/copybooks/trans/SAM2PARM.cpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
****************************************************************
* LICENSED MATERIALS - PROPERTY OF IBM
* "RESTRICTED MATERIALS OF IBM"
* (C) COPYRIGHT IBM CORPORATION 2018. ALL RIGHTS RESERVED
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION,
* OR DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE
* CONTRACT WITH IBM CORPORATION
****************************************************************
01 SAM2-PARMS.
05 CRUNCH-TOTAL PIC 9(16).

COPY SAM2PAR5.
38 changes: 38 additions & 0 deletions multiroot/copybooks/trans/TRANREC.cpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
****************************************************************
* LICENSED MATERIALS - PROPERTY OF IBM
* "RESTRICTED MATERIALS OF IBM"
* (C) COPYRIGHT IBM CORPORATION 2022. ALL RIGHTS RESERVED
* US GOVERNMENT USERS RESTRICTED RIGHTS - USE, DUPLICATION,
* OR DISCLOSURE RESTRICTED BY GSA ADP SCHEDULE
* CONTRACT WITH IBM CORPORATION
****************************************************************
01 TRANSACTION-RECORD.
05 TRAN-CODE PIC X(6).
05 FILLER REDEFINES TRAN-CODE.
10 TRAN-COMMENT PIC X.
10 FILLER PIC X(5).
05 FILLER PIC X.
05 TRAN-PARMS.
10 TRAN-KEY PIC X(06).
10 FILLER PIC X(08).
10 TRAN-ACTION PIC X(8).
10 FILLER PIC X.
10 TRAN-FIELD-NAME PIC X(10).
10 FILLER PIC X.
10 TRAN-FIELD-SS PIC 99.
10 FILLER PIC X.
10 TRAN-UPDATE-DATA PIC X(36).
10 FILLER REDEFINES TRAN-UPDATE-DATA.
15 TRAN-UPDATE-NUM PIC 9(7)V99.
15 FILLER PIC X(27).
10 FILLER REDEFINES TRAN-UPDATE-DATA.
15 TRAN-UPDATE-NUMX.
20 TRAN-UPDATE-NUMX1 PIC X.
20 TRAN-UPDATE-NUMX2-7 PIC X(6).
15 TRAN-UPDATE-NUM-HH PIC 99.
15 FILLER PIC X(27).
05 CRUNCH-PARMS REDEFINES TRAN-PARMS.
10 CRUNCH-KEY PIC X(6).
10 FILLER PIC X.
10 CRUNCH-CPU-LOOPS PIC 9(9).
10 FILLER PIC X(57).
Loading

0 comments on commit d88b4c2

Please sign in to comment.