This tutorial shows you how to import, edit, compile, and run the BankDemo sample application in Rocket Enterprise Developer, and then to commit your changes to trigger a CI/CD pipeline.
Contents
Exercise 1: Enhance Loan Calculation in BANKDEMO Application
Exercise 2: Extract loan calculation in BankDemo application
Prerequisites
Download the following files.
-
basic-infra.yaml
-
pipeline.yaml
-
m2-code-sync-function.zip
-
config_git.yml
-
BANKDEMO-source.zip
-
BANKDEMO-exercise.zip
The purpose of each file is as follows:
basic-infra.yaml
-
This AWS CloudFormation template creates the basic infrastructure needed for the CI/CD pipeline: VPC, Amazon S3 buckets, and so on.
pipeline.yaml
-
This AWS CloudFormation template is used by an Lambda function to launch the pipeline stack. Make sure this template is located in a publicly accessible Amazon S3 bucket. Add the link to this bucket as the default value for the
PipelineTemplateURL
parameter in thebasic-infra.yaml
template. m2-code-sync-function.zip
-
This Lambda function creates the CodeCommit repository, the directory structure based on the
config_git.yaml
, and launches the pipeline stack usingpipeline.yaml
. Make sure this zip file is available in a publicly accessible Amazon S3 bucket in all the AWS Regions where AWS Mainframe Modernization is supported. We recommend that you store the file in a bucket in one AWS Region and replicate it to buckets across all AWS Regions. Use a naming convention for the bucket with a suffix that identifies the specific AWS Region (for example,m2-cicd-deployment-source-eu-west-1
) and add the prefixm2-cicd-deployment-source
as default value for parameterDeploymentSourceBucket
and form the full bucket by using the AWS CloudFormation substitution function!Sub {DeploymentSourceBucket}-${AWS::Region}
while referring to that bucket in thebasic-infra.yaml
template for resourceSourceSyncLambdaFunction
. config_git.yml
-
CodeCommit directory structure definition. For more information, see Sample YAML Trigger File config_git.yml.
BANKDEMO-source.zip
.-
BankDemo source code and configuration file created from the CodeCommit repository.
BANKDEMO-exercise.zip
.-
BankDemo source for tutorial exercises created from the CodeCommit repository.
Create CI/CD pipeline basic infrastructure
Use the AWS CloudFormation template basic-infra.yaml
to create the CI/CD pipeline basic
infrastructure stack through the AWS CloudFormation console. This stack creates Amazon S3 buckets where you
upload your application code and data, and a supporting AWS Lambda function to create
other necessary resources such as an AWS CodeCommit repository and an AWS CodePipeline pipeline.
Note
To launch this stack you need permissions to administer IAM, Amazon S3, Lambda, and AWS CloudFormation and permissions to use AWS KMS.
-
Sign in to the AWS Management Console and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation
. -
Create a new stack by using one of the following options:
-
Choose Create Stack. This is the only option if you have a currently running stack.
-
On the Stacks page, choose Create Stack. This option is visible only if you have no running stacks.
-
-
On the Specify template page:
-
In Prepare template, choose Template is ready.
-
In Specify template, choose Amazon S3 URL as the template source and enter one of the following URLs depending on your AWS Region.
-
https://m2-us-east-1.s3.us-east-1.amazonaws.com/cicd/mf/basic-infra.yaml
-
https://m2-eu-central-1.s3.eu-central-1.amazonaws.com/cicd/mf/basic-infra.yaml
-
-
To accept your settings, choose Next.
The Create stack page opens.
Make the following changes:
-
Provide appropriate values for Stack name and parameters for Networking Configuration.
-
Most parameters in Deployment Configurations are pre-populated appropriately so you don’t need to modify them. Depending on your AWS Region, change the pipeline AWS CloudFormation template to one of the following Amazon S3 URLs.
-
https://m2-us-east-1.s3.amazonaws.com/cicd/mf/pipeline.yaml
-
https://m2-eu-central-1.s3.eu-central-1.amazonaws.com/cicd/mf/pipeline.yaml
-
-
Choose Next.
Note
Don’t change the default parameter values unless you have modified the AWS CloudFormation template yourself.
-
-
In Configure stack options, choose Next.
-
In Capabilities, choose I acknowledge that AWS CloudFormation might create IAM resources to allow permission for AWS CloudFormation to create IAM Role on your behalf. Choose Create stack.
Note
It can take 3 to 5 minutes for this stack to be provisioned.
-
After the stack has been created successfully, navigate to the Outputs section of the newly provisioned stack. There you'll find the Amazon S3 bucket where you need to upload your mainframe code and dependent files.
Create AWS CodeCommit repository and CI/CD pipeline
In this step, you create a CodeCommit repository and provision a CI/CD pipeline stack by calling a Lambda function that calls AWS CloudFormation to create the pipeline stack.
-
Download the BankDemo sample application
to your local machine. -
Upload
bankdemo.zip
from your local machine to the Amazon S3 bucket created in Create CI/CD pipeline basic infrastructure. -
Download
config_git.yml
. -
Modify the
config_git.yml
if needed, as follows:-
Add your own target repository name, target branch and commit message.
repository-config: target-repository: bankdemo-repo target-branch: main commit-message: Initial commit for bankdemo-repo main branch
-
Add the email address you want to receive notifications.
pipeline-config: # Send pipeline failure notifications to these email addresses alert-notifications: - myname@mycompany.com # Send notifications for manual approval before production deployment to these email addresses approval-notifications: - myname@mycompany.com
-
-
Upload the
config_git.yml
file containing the definition of the CodeCommit repository folder structure to the Amazon S3 bucket created in Create CI/CD pipeline basic infrastructure. This will invoke the Lambda function that will automatically provision the repository and pipeline.This will create a CodeCommit repository with the name provided in the
target-repository
defined in theconfig_git.yml
file; for example,bankdemo-repo
.The Lambda function will also create the CI/CD pipeline stack through AWS CloudFormation. The AWS CloudFormation stack will have the same prefix as the
target-repository
name provided followed by a random string (for examplebankdemo-repo-
. You can find the CodeCommit repository URL and the URL to access the created pipeline in the AWS Management Console.01234567
-
If the CodeCommit repository creation is complete, the CI/CD pipeline will be triggered immediately to perform a full CI/CD.
-
Once the file has been pushed it will automatically trigger the pipeline which will build, deploy in staging, run some tests and wait for manual approval before getting it deployed in the production environment.
Sample YAML Trigger File config_git.yml
repository-config:
target-repository: bankdemo-repo
target-branch: main
commit-message: Initial commit for bankdemo-repo main branch
directory-structure:
- '/':
files:
- build.xml
- '*.yaml'
- '*.yml'
- '*.xml'
- 'LICENSE.txt'
readme: |
# Root Folder
- 'build.xml' : Build configuration for the application
- tests:
files:
- '*.py'
readme: |
# Test Folder
- '*.py' : Test scripts
- config:
files:
- 'BANKDEMO.csd'
- 'BANKDEMO.json'
- 'BANKDEMO_ED.json'
- 'dfhdrdat'
- 'ESPGSQLXA.dll'
- 'ESPGSQLXA64.so'
- 'ESPGSQLXA64_S.so'
- 'EXTFH.cfg'
- 'm2-2021-04-28.normal.json'
- 'MFDBFH.cfg'
- 'application-definition-template-config.json'
readme: |
# Config Folder
This folder contains the application configuration files.
- 'BANKDEMO.csd' : CICS Resource definitions export file
- 'BANKDEMO.json' : Enterprise Server configuration
- 'BANKDEMO_ED.json' : Enterprise Server configuration for ED
- 'dfhdrdat' : CICS resource definition file
- 'ESPGSQLXA.dll' : XA switch module Windows
- 'ESPGSQLXA64.so' : XA switch module Linux
- 'ESPGSQLXA64_S.so' : XA switch module Linux
- 'EXTFH.cfg' : Micro Focus File Handler configuration
- 'm2-2021-04-28.normal.json' : M2 request document
- 'MFDBFH.cfg' : Micro Focus Database File Handler
- 'application-definition-template-config.json' : Application definition for M2
- source:
subdirs:
- .settings:
files:
- '.bms.mfdirset'
- '.cbl.mfdirset'
- copybook:
files:
- '*.cpy'
- '*.inc'
readme: |
# Copy folder
This folder contains the source for COBOL copy books, PLI includes, ...
- .cpy COBOL copybooks
- .inc PLI includes
# - ctlcards:
# files:
# - '*.ctl'
# - 'KBNKSRT1.txt'
# readme: |
# # Control Card folder
# This folder contains the source for Batch Control Cards
# - .ctl Control Cards
- ims:
files:
- '*.dbd'
- '*.psb'
readme: |
# ims folder
This folder contains the IMS DB source files with the extensions
- .dbd for IMS DBD source
- .psb for IMS PSB source
- jcl:
files:
- '*.jcl'
- '*.ctl'
- 'KBNKSRT1.txt'
- '*.prc'
readme: |
# jcl folder
This folder contains the JCL source files with the extensions
- .jcl
# - proclib:
# files:
# - '*.prc'
# readme: |
# # proclib folder
# This folder contains the JCL procedures referenced via PROCLIB statements in the JCL with extensions
# - .prc
- rdbms:
files:
- '*.sql'
readme: |
# rdbms folder
This folder contains any DB2 related source files with extensions
- .sql for any kind of SQL source
- screens:
files:
- '*.bms'
- '*.mfs'
readme: |
# screens folder
This folder contains the screens source files with the extensions
- .bms for CICS BMS screens
- .mfs for IMS MFS screens
subdirs:
- .settings:
files:
- '*.bms.mfdirset'
- cobol:
files:
- '*.cbl'
- '*.pli'
readme: |
# source folder
This folder contains the program source files with the extensions
- .cbl for COBOL source
- .pli for PLI source
subdirs:
- .settings:
files:
- '*.cbl.mfdirset'
- tests:
files:
- 'test_script.py'
readme: |
# tests Folder
This folder contains the application test scripts
pipeline-config:
alert-notifications:
- myname@mycompany.com
approval-notifications:
- myname@mycompany.com
Enterprise Developer AppStream 2.0 Creation
To set up Rocket Enterprise Developer on AppStream 2.0, see Tutorial: Set up Rocket Enterprise Developer on AppStream 2.0.
To connect the CodeCommit repository to Enterprise Developer, use the name specified in
target-repository
in Sample YAML Trigger File
config_git.yml.
Enterprise Developer Setup and Test
Topics
Connect to the Enterprise Developer AppStream 2.0 instance you created in Enterprise Developer AppStream 2.0 Creation.
-
Start Enterprise Developer from Windows Start. Choose Micro Focus Enterprise Developer, then choose Enterprise Developer for Eclipse. If you are starting for the first time, it might take some time.
-
In the Eclipse Launcher, in Workspace: enter
C:\Users\<username>\workspace
then choose Launch.Note
Make sure you choose the same location after reconnecting to the AppStream 2.0 instance. Workspace selection is not persistent.
-
In Welcome, choose Open COBOL Perspective. This will only be shown the first time for a new workspace.
Clone the BankDemo CodeCommit repository in Enterprise Developer
-
Choose Window / Perspective / Open Perspective / Other ... / Git.
-
Choose Clone a Git repository.
-
In Clone Git Repository, enter the following information:
-
In Location URI, enter the HTTPS URL of the CodeCommit repository.
Note
Copy the Clone URL HTTPS for the CodeCommit repository in the AWS Management Console and paste it here. The URI will be split into the Host and Repository paths..
-
The user CodeCommit repository credentials in Authentication User and Password and choose Store in Secure Store.
-
-
In Branch Selection, choose Main branch, then choose Next.
-
In Local Destination, in Directory, enter
C:\Users\<username>\workspace
and choose Finish.The clone process is completed when
BANKDEMO [main]
is shown in the Git Repositories view.
Create BankDemo mainframe COBOL project and build application
-
Change to COBOL Perspective.
-
In Project, disable Build Automatically.
-
In File, choose New, then Mainframe COBOL Project.
-
In New Mainframe COBOL Project, enter the following information:
-
In Project name, enter
BankDemo
. -
Choose Micro Focus template [64 bit].
-
Choose Finish.
-
-
In COBOL Explorer, expand the new BankDemo project.
Note
[BANKDEMO main]
in square brackets indicates that the project is connected with the local BankDemo CodeCommit repository. -
If the tree view does not show entries for COBOL Programs, Copybooks, BMS Source, and JCL Files, choose Refresh from the BankDemo project context menu.
-
From the BankDemo context menu, choose Properties / Micro Focus / Project Settings / COBOL:
-
Choose Character Set - ASCII.
-
Choose Apply, then Close.
-
-
If the build of the BMS and COBOL source does not immediately start, check in the Project menu, that the option Build Automatically is enabled.
The Build output will be displayed in the Console view and should complete after a few minutes with messages
BUILD SUCCESSFUL
andBuild finished with no errors
.The BankDemo application should now be compiled and ready for local execution.
Create local BankDemo CICS and batch environment for testing
-
In COBOL Explorer, expand
BANKDEMO / config
. -
In the editor, open
BANKDEMO_ED.json
. -
Find string
ED_Home=
and change path to point to the Enterprise Developer project, as follows:D:\\<username>\\workspace\\BANKDEMO
. Note the use of double slashes (\\
)in the path definition. -
Save and close the file.
-
Choose Server Explorer.
-
From the Default context menu, choose Open Administration Page. The Micro Focus Enterprise Server Administration page is opened in the default browser.
-
For AppStream 2.0 sessions only, make the following changes so you can preserve your local Enterprise Server region for local testing:
-
In Directory Server / Default, choose PROPERTIES / Configuration.
-
Replace Repository Location with
D:\<username>\My Files\Home Folder\MFDS
.
Note
You must complete steps 5 - 8 after every new connection to an AppStream 2.0 instance.
-
-
In Directory Server / Default, choose Import, then complete the following steps:
-
In Step 1: Import Type, choose JSON and choose Next.
-
In Step 2: Upload, click to upload file in blue square.
-
In Choose File to Upload, enter:
-
File name:
D:\<username>\workspace\BANKDEMO\config\BANKDEMO_ED.json
. -
Choose Open.
-
-
Choose Next.
-
In Step 3: Regions clear Clear Ports from Endpoints.
-
Choose Next.
-
In Step 4: Import, choose Import.
-
Choose Finish.
The list will now show a new server name
BANKDEMO
. -
Start the BANKDEMO server from Enterprise Developer
-
Choose Enterprise Developer.
-
In Server Explorer, choose Default, then choose Refresh from the context menu.
The server list should now also show BANKDEMO.
-
Choose BANKDEMO.
-
From the context menu, choose Associate with project, then choose BANKDEMO.
-
From the context menu, choose Start.
The Console view should display the log for the server startup.
If the message
BANKDEMO CASSI5030I PLTPI Phase 2 List(PI) Processing Completed
is displayed, the Server is ready for testing the CICS BANKDEMO application.
Start the Rumba 3270 terminal
-
From Windows Start, launch Micro Focus Rumba+ Desktop / Rumba+ Desktop.
-
In Welcome, choose CREATE NEW SESSION / Mainframe Display.
-
In Mainframe Display, choose Connection / Configure.
-
In Session Configuration, choose Connection / TN3270.
-
In Host Name / Address, choose Insert and enter IP address
127.0.0.1
. -
In Telnet Port, enter port
6000
. -
Choose Apply.
-
Choose Connect.
The CICS welcome screen displays screen with row 1 message:
This is the Micro Focus MFE CICS region BANKDEMO
. -
Press CTRL+Shift+Z to clear screen.
Run a BankDemo transaction
-
In an empty screen, enter
BANK
. -
In screen BANK10, in the input field for User id.....:, enter
guest
and press Enter. -
In screen BANK20, in the input field before Calculate the cost of a loan, enter
/
(forward slash) and press Enter. -
In screen BANK70:
-
In The amount you would like to borrow...:, enter
10000
. -
In At an interest rate of................:, enter
5.0
. -
In For how many months...................:, enter
10
. -
Press Enter.
The following result should be displayed:
Resulting monthly payment.............: $1023.06
This completes the BANKDEMO application setup in Enterprise Developer.
-
Stop the BANKDEMO server from Enterprise Developer
-
In Server Explorer, choose Default, then choose Refresh from the context menu.
-
Choose BANKDEMO.
-
From the context menu, choose Stop.
The Console view should display the log for the server stopping.
If the message
Server: BANKDEMO stopped successfully
is displayed, the server has successfully shut down.
Exercise 1: Enhance Loan Calculation in BANKDEMO
Application
Topics
In this scenario, you walk through the process of making a sample change to the code, deploying it, and testing it.
The Loan department wants a new field on the Loan Calculation screen BANK70 to show the Total Loan Amount. This requires a change of the BMS screen MBANK70.CBL, adding a new field and the corresponding screen handling program SBANK70P.CBL with related copybooks. In addition, the loan calculation routine in BBANK70P.CBL needs to be extended with the additional formula.
To complete this exercise, make sure you complete the following prerequisites.
-
Download BANKDEMO-exercise.zip
to D:\PhotonUser\My Files\Home Folder
. -
Extract the zip file to
D:\PhotonUser\My Files\Home Folder\BANKDEMO-exercise
. -
Create folder
D:\PhotonUser\My Files\Home Folder\AnalysisRules
. -
Copy the rules file
Loan+Calculation+Update.General-1.xml
from theBANKDEMO-exercise
folder toD:\PhotonUser\My Files\Home Folder\AnalysisRules
.
Note
Code changes in *.CBL and *.CPY are marked with EXER01 in column 1 - 6 for this exercise.
Add loan analysis rule to Enterprise Developer Code Analysis
Analysis rules defined in Rocket Enterprise Analyzer can be exported from Enterprise Analyzer and imported into Enterprise Developer to run same analysis rules across the sources in the Enterprise Developer project.
-
Open
Window/Preferences/Micro Focus/COBOL/Code Analysis/Rules
. -
Choose Edit... and enter the folder name
D:\PhotonUser\My Files\Home Folder\AnalysisRules
containing the rules fileLoan+Calculation+Update.General-1.xml
. -
Choose Finish.
-
Choose Apply, then choose Close.
-
From the BANKDEMO project context menu, choose Code Analysis.
You should see an entry for Loan Calculation Update.
Step 1: Perform code analysis for loan calculation
With the new analysis rule we want to identify the COBOL programs and lines of code in
there that are matching the search patterns *PAYMENT*
, *LOAN*
and *RATE*
in expressions, statements and variables. This will help to
navigate through the code and identify required code changes.
-
From the BANKDEMO project context menu, choose Code Analysis/Loan Calculation Update.
This will run the search rule and list the results in a new tab called Code Analysis. The analysis run is completed when the green progress bar at the bottom right disappears.
The Code Analysis tab should display an expanded list of
BBANK20P.CBL
,BBANK70P.CBL
andSBANK70P.CBL
, each listing the statements, expressions and variables matching the search patterns.Looking at the result for
BBANK20P.CBL
there are only literals moved that have a match with search pattern. So this program can be ignored. -
In the tab menu bar choose - Icon to collapse all.
-
Expand
SBANK70P.CBL
and select any lines in any order with a double-click to see how this will open the source and highlight the line selected in source code. You will also recognize that all identified source lines are marked.
Step 2: Modify CICS BMS map and COBOL program and test
First we will change the BMS map MBANK70.BMS
and the screen
handling program SBANK70P.CBL
and copybook
CBANKDAT.CPY
to display the new field. To avoid unnecessary coding
in this exercise, modified source modules are available in the D:\PhotonUser\My
Files\Home Folder\BANKDEMO-exercise\Exercise01
folder. Normally a developer
would use the Code Analysis results to navigate and modify the sources. If you have the
time and and want to do the manual changes do so with the information provided in *Manual
change in MBANK70.BMS and SBANK70P.CBL (Optional)*.
For quick changes, copy the following files:
-
..\BANKDEMO-exercise\Exercis01\screens\MBANK70.BMS
toD:\PhotonUser\workspace\bankdemo\source\screens
. -
.\BANKDEMO-exercise\Exercis01\cobol\SBANK70P.CBL
toD:\PhotonUser\workspace\bankdemo\source\cobol
. -
..\BANKDEMO-exercise\Exercis01\copybook\CBANKDAT.CPY
toD:\PhotonUser\workspace\bankdemo\source\copybook
. -
To ensure that all programs impacted by the changes are compiled, choose Project/Clean.../Clean all project.
For manual changes to MBANK70.BMS
and
SBANK70P.CBL
, complete the following steps:
-
For manual change in BMS
MBANK70.BMS
source add after thePAYMENT
field:-
TXT09 with same attributes as TXT08 and INITIAL value “Total Loan Amount”
-
TOTAL with same attributes as PAYMENT
-
Test changes
To test the changes, repeat the steps in the following sections:
-
In addition you should now also see the text
Total Loan Amount.....................:
.
Step 3: Add total amount calculation in COBOL program
In the second step we will change BBANK70P.CBL
and add the
calculation for the total loan amount. The prepared source with required changes is
available in D:\PhotonUser\My Files\Home
Folder\BANKDEMO-exercise\Exercise01
folder. If you have the time and want
to do the manual changes do so with the information provided in *Manual change in
BBANK70P.CBL (Optional)*.
For quick change, copy the following file:
-
..\BANKDEMO-exercise\Exercis01\source\cobol\BBANK70P.CBL
toD:\PhotonUser\workspace\bankdemo\source\cobol
.
To make a manual change to BBANK70P.CBL
, complete the following
steps:
-
Use the Code Analysis result to identify the required changes.
Test changes
To test the changes, repeat the steps in the following sections:
-
In addition you should now also see the text
Total Loan Amount.....................: $10230.60
.
Step 4: Commit changes and run CI/CD pipeline
Commit the changes to the central CodeCommit repository and trigger the CI/CD pipeline to build, test, and deploy the changes.
-
From BANKDEMO project, in the context menu, choose Team/Commit.
-
In the Git Staging tab, enter the following commit message:
Added Total Amount Calculation
. -
Choose Commit and Push....
-
Open the CodePipeline console and check status of the pipeline execution.
Note
In case you face any problem with the Enterprise Developer or Teams function Commit or Push, use the Git Bash command line interface.
Exercise 2: Extract loan calculation in BankDemo
application
Topics
In this next exercise, you work through another sample change request. In this scenario,
the Loan department want to reuse the loan calculation routine as a standalone WebService. The
routine should remain in COBOL and should also still be callable from the existing CICS COBOL
program BBANK70P.CBL
.
Step 1: Refactor loan calculation routine into a COBOL section
In the first step we extract the loan calculation routine into a COBOL Section. This step is required to extract the code into a stand-alone COBOL program in the next step.
-
Open
BBANK70P.CBL
in the COBOL Editor. -
In the editor, choose from the context menu Code Analysis/Loan Calculation Update. This will only scan the current source for patterns defined in the analysis rule.
-
In the result in the Code Analysis tab, find the first arithmetic statement
DIVIDE WS-LOAN-INTEREST BY 12
. -
Double click on the statement to navigate to source line in Editor. This is the first statement of the loan calculation routine.
-
Mark the following code block for loan calculation routine to be extracted to a section.
DIVIDE WS-LOAN-INTEREST BY 12 GIVING WS-LOAN-INTEREST ROUNDED. COMPUTE WS-LOAN-MONTHLY-PAYMENT ROUNDED = ((WS-LOAN-INTEREST * ((1 + WS-LOAN-INTEREST) ** WS-LOAN-TERM)) / (((1 + WS-LOAN-INTEREST) * WS-LOAN-TERM) - 1 )) * WS-LOAN-PRINCIPAL. EXER01 COMPUTE WS-LOAN-TOTAL-PAYMENT = EXER01 (WS-LOAN-MONTHLY-PAYMENT * WS-LOAN-TERM).
-
From the context menu in the editor, choose Refactor/Extract to Section....
-
Enter New section name: LOAN-CALCULATION.
-
Choose OK.
The marked code block has now been extracted to the new
LOAN-CALCULATION
section and the code block has been replaced with thePERFROM LOAN-CALCULATION
statement.
Test changes
To test the changes repeat the steps described in the following sections.
-
In addition you should now also see the text
Total Loan Amount.....................: $10230.60
. -
Stop the BANKDEMO server from Enterprise Developer
Note
If you want to avoid the above steps to extract the code block to a section you can copy the modified source for Step 1 from
..\BANKDEMO-exercise\Exercis02\Step1\cobol\BBANK70P.CBL
toD:\PhotonUser\workspace\bankdemo\source\cobol
.
Step 2: Extract loan calculation routine to a standalone COBOL program
In Step 2 the code block in the LOAN-CALCULATION
section will be
extracted to a standalone program and the original code will be replaced with code to call
the new subprogram.
-
Open
BBANK70P.CBL
in editor and find the newPERFORM LOAN-CALCULATION
statement created in Step 1. -
Place the cursor within the section name. It will be marked grey.
-
From the context menu, select Refactor->Extract Section/Paragraph to Program....
-
In Extract Section/Paragraph to Program, enter New file name: LOANCALC.CBL.
-
Choose OK.
The new
LOANCALC.CBL
program will open in the editor. -
Scroll down and review the code being extracted and generated for the call interface.
-
Select editor with
BBANK70P.CBL
and go toLOAN-CALCULATION SECTION
. Review the code being generated to call the new sub-programLOANCALC.CBL
.Note
The
CALL
statement is usingDFHEIBLK
andDFHCOMMAREA
to callLOANCALC
with CICS control blocks. Because we want to call the newLOANCALC.CBL
sub-program as non-CICS program, we have to removeDFHEIBLK
andDFHCOMMAREA
from the call either by commenting out or deleting.
Test changes
To test the changes repeat the steps described in the following sections.
-
In addition you should now also see the text
Total Loan Amount.....................: $10230.60
. -
Stop the BANKDEMO server from Enterprise Developer
Note
If you want to avoid the above steps to extract the code block to a section you can copy the modified source for Step 1 from
..\BANKDEMO-exercise\Exercis02\Step2\cobol\BBANK70P.CBL
andLOANCALC.CBL
toD:\PhotonUser\workspace\bankdemo\source\cobol
.
Step 3: Commit changes and run the CI/CD pipeline
Commit the changes to the central CodeCommit repository and trigger the CI/CD pipeline to build, test and deploy the changes.
-
From BANKDEMO project, in the context menu, choose Team/Commit.
-
In the Git Staging tab
-
Add in Unstaged Stages LOANCALC.CBL and LOANCALC.CBL.mfdirset.
-
Enter a commit message:
Added Total Amount Calculation
.
-
-
Choose Commit and Push....
-
Open the CodePipeline console and check status of the pipeline execution.
Note
In case you face any problem with the Enterprise Developer or Teams function Commit or Push, use the Git Bash command line interface.
Clean up resources
If you no longer need the resources you created for this tutorial, delete them so that you won't continue to be charged for them. Complete the following steps:
-
Delete the CodePipeline pipeline. For more information, see Delete a pipeline in CodePipeline in the AWS CodePipeline User Guide.
-
Delete the CodeCommit repository. For more information, see Delete an CodeCommit repository in the AWS CodeCommit User Guide.
-
Delete the S3; bucket. For more information, see Deleting a bucket in the Amazon Simple Storage Service User Guide.
-
Delete the AWS CloudFormation stack. For more information, see Deleting a stack on the AWS CloudFormation console in the AWS CloudFormation User Guide.