This repository provides sample COBOL and PL/I programs, along with JCL and data files to compile and run them.
These examples are provided to allow you to not only experience the IBM Z® Open Editor, but also in conjunction with the Zowe VS Code Extension, experience the powerful capabilities for IBM z/OS development and processing.
The sample applications consist of the following files:
- COBOL programs:
SAM1
andSAM2
- COPYBOOKS:
CUSTCOPY
andTRANREC
- Data source files:
CUSTFILE
andTRANFILE
- JCL members that set up and run the application:
ALLOCATE
andRUN
.- Please Note - the JCL files are to be used as templates, you may need to update the compiler library name and you will need to update the
HLQ
parm with your TSO user id
- Please Note - the JCL files are to be used as templates, you may need to update the compiler library name and you will need to update the
SAM1
reads in both the CUSTFILE
and TRANFILE
data files, then performs different actions on the CUSTFILE
based on transactions from TRANFILE
. Valid transactions are ADD
, UPDATE
, and DELETE
. When an UPDATE
transaction is processed, SAM1
calls SAM2
to perform the requested update. At the end of processing the TRANFILE
, SAM1
generates a report on the transactions processed and produces an updated CUSTFILE
.
SAM2
also includes some base code in place for CRUNCH
transactions which are mentioned in the Use Case below.
The ALLOCATE.jcl
file will allocate the necessary data sets on the MVS host that need to be in place prior to using the Zowe CLI
commands to copy the files from your local workspace into the pre-allocated data sets and to run the application. The RUN.jcl
will compile, link, and run the programs.
The files created with the ALLOCATE.jcl
are:
USER1.SAMPLE.COBOL
USER1.SAMPLE.COBCOPY
USER1.SAMPLE.OBJ
USER1.SAMPLE.LOAD
USER1.SAMPLE.CUSTFILE
USER1.SAMPLE.TRANFILE
The application creates a new CUSTFILE
and produces a customer report in USER1.SAMPLE.CUSTRPT
.
The repository for these example files also has another branch called Tutorial-Complete
which contains files that are the result of the following use case. Using VS Code's GIT capabilities, you can switch branches to Tutorial-Complete
where you will notice some new files.
A sample use case might be that you have received requirements to enhance the Daily Customer File Update Report to include the total number of customers as well as information regarding "Crunch" transactions. A "Crunch" transaction is a request to calculate the average monthly order revenue for a specific customer. The current daily report simply displays the first 80 bytes of each transaction record as well as total counts for each type of transaction.
In looking at the files, you will notice a new COPYBOOK, 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.
- PL/I programs:
PSAM1
andPSAM2
- INCLUDES:
BALSTATS
andCUSTPLI
- Data source files:
PLI.TRANFILE
andPLI.CUSTFILE
- JCL members that set up and run the application:
PLIALLOC
andRUNPSAM1
.- Please Note - the JCL files are to used as templates, you may need to update the compiler library name and you will need to update the
HLQ
parm with your TSO user id
- Please Note - the JCL files are to used as templates, you may need to update the compiler library name and you will need to update the
PSAM1
reads in both the PLI.CUSTFILE
and PLI.TRANFILE
data files, then produces a report with customer information and a Totals summary section. Valid transactions are PRINT
and TOTALS
. A PRINT
transaction prints the Customer records to the Customer section of the report. When PSAM1
reads in a TOTALS
transaction, it generates the Totals Report section.
PSAM2
generates running totals from amounts passed in from PSAM1
.
The PLIALLOC.jcl
file will allocate the necessary data sets on the MVS host that need to be in place prior to using the Zowe CLI commands to copy the files from your local workspace into the pre-allocated data sets and to run the application. The RUNPSAM1.jcl
will compile, link, and run the programs.
The files created with the PLIALLOC.jcl
are:
USER1.SAMPLE.PLIOBJ
USER1.SAMPLE.PLILOAD
USER1.SAMPLE.PLI
USER1.SAMPLE.PLINC
USER1.SAMPLE.PLI.CUSTFILE
USER1.SAMPLE.PLI.TRANFILE
The application creates a report, USER1.SAMPLE.PLI.CUSTRPT
.
A sample use case for the PL/I programs might be that PSAM1
needs to process a new type of Customer record called a Product record and generate a new line for Service Calls in the Totals Report section. You could accomplish this by creating a new program, PSAM3
to process these new records and produce the product statistics needed on the report.
Again, in the Tutorial-Complete
branch, notice the new program PSAM3
, the new Include PRODSTATS
which is used for the data being passed between PSAM1
and PSAM3
.