60
© 2013 Heirloom Computing Inc All Rights Reserved i Elastic COBOL Enterprise Developer Getting Started Guide REVISION: OCTOBER 2013 The contents of this manual may be revised without prior notice. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the expressed written permission of Heirloom Computing Inc. Heirloom Computing has made every effort to ensure that this manual is correct and accurate, but reserves the right to make changes without notice at its sole discretion at any time.

Elastic COBOL Getting Started

Embed Size (px)

DESCRIPTION

Elastic COBOL Getting Started

Citation preview

  • 2013 Heirloom Computing Inc All Rights Reserved

    i

    Elastic COBOL Enterprise Developer

    Getting Started Guide

    REVISION: OCTOBER 2013

    The contents of this manual may be revised without prior notice. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the expressed written permission of Heirloom Computing Inc.

    Heirloom Computing has made every effort to ensure that this manual is correct and accurate, but reserves the right to make changes without notice at its sole discretion at any time.

  • Elastic COBOL Getting Started Guide 1

    Contents

    GENERAL INFORMATION ............................................................................................................................... 3

    PURPOSE ............................................................................................................................................................. 3 PREFACE ............................................................................................................................................................. 3 TRADEMARKS ..................................................................................................................................................... 3

    INTEGRATED DEVELOPMENT ENVIRONMENT ........................................................................................ 4

    INSTALLING & STARTING THE ELASTIC COBOL IDE ......................................................................................... 4 Elastic COBOL Requirements (READ ME) .................................................................................................. 4 Licensing ....................................................................................................................................................... 4 Eclipse Perspectives ...................................................................................................................................... 5 Using this Guide ............................................................................................................................................ 5 Cloud (Hosted) .............................................................................................................................................. 5 Windows & Linux/UNIX (Open Systems) ...................................................................................................... 6 Starting the Elastic COBOL IDE for the first time ........................................................................................ 7

    INTRODUCTION .................................................................................................................................................. 7 ELASTIC COBOL TOOLBAR ............................................................................................................................... 8 CREATING A NEW ELASTIC COBOL PROJECT .................................................................................................... 9 GENERAL PROJECT PROPERTIES ....................................................................................................................... 10

    COBOL Compiler Settings .......................................................................................................................... 10 COBOL Execution Settings ......................................................................................................................... 11

    MANAGING APPLICATION ARTIFACTS ............................................................................................................... 11 Creating a New Program ............................................................................................................................ 11 Adding Existing Artifacts to a Project ......................................................................................................... 12

    EDITING, COMPILING AND RUNNING A PROJECT ............................................................................................... 13 Incremental Compilation ............................................................................................................................. 13 Compilation Messages ................................................................................................................................ 13 Program Execution ..................................................................................................................................... 14

    ELASTIC COBOL FILE AND RECORD SERVERS ................................................................................................. 15

    DEBUGGING IN ELASTIC COBOL ............................................................................................................... 16

    DEBUG OVERVIEW ........................................................................................................................................... 16 SETTING BREAKPOINTS ..................................................................................................................................... 16 STARTING A DEBUG SESSION ............................................................................................................................ 16 USING THE DEBUGGER ..................................................................................................................................... 18 VARIABLES VIEW ............................................................................................................................................. 18 QUERY VARIABLES VIA HOVER OVER .............................................................................................................. 19 BREAKPOINTS VIEW ......................................................................................................................................... 19 DEBUGGING COMPOSITE APPLICATIONS ........................................................................................................... 20 REMOTE DEBUGGING ....................................................................................................................................... 21

    APPLICATION DEPLOYMENT ...................................................................................................................... 25

    DEPLOYMENT OVERVIEW ................................................................................................................................. 25 JAVA RUNTIME ENVIRONMENT (JRE) .............................................................................................................. 25 USING THE EXPORT (DEPLOY) WIZARDS .......................................................................................................... 26 STANDALONE APPLICATIONS ............................................................................................................................ 30

    Console Command Line .............................................................................................................................. 30 INSTALLING ADDITIONAL SOFTWARE ............................................................................................................... 30 SERVLET APPLICATIONS ................................................................................................................................... 33

    Building a Servlet Application .................................................................................................................... 33

  • Elastic COBOL Getting Started Guide 2

    Packaging & Deploying Servlet Applications ............................................................................................. 35 Executing Servlet Applications .................................................................................................................... 37 Debugging Servlet Applications .................................................................................................................. 38 Iterative Debugging, Development & Deployment ..................................................................................... 42

    CICS APPLICATIONS ..................................................................................................................................... 43

    OVERVIEW ........................................................................................................................................................ 43 CREATING A CICS COBOL PROJECT ............................................................................................................... 43

    Additional Software Requirements .............................................................................................................. 43 Setting up the Application Server ................................................................................................................ 44 Creating an ETP Project Part 1 Application Project ............................................................................ 46 Data Migration (VSAM to Relational) ........................................................................................................ 49 Resolving Port Conflict ............................................................................................................................... 52 Setting up the Relational Database ............................................................................................................. 53 Creating an ETP Project Part 2 Deployment Project ........................................................................... 55 Deploying an ETP Project .......................................................................................................................... 57 Executing an ETP Application .................................................................................................................... 59

  • Elastic COBOL Getting Started Guide 3

    General Information

    Purpose

    The purpose of this Getting Started Guide is to provide you with a level of familiarization that enables you to be immediately productive with the Elastic COBOL toolset.

    This guide will cover the most commonly used functions that represent the simple application development lifecycle of edit, compile & debug. It will also provide an overview of the various deployment options for executing your application.

    Preface

    Elastic COBOL is a feature rich implementation for any developer working with enterprise, commercial or educational COBOL applications.

    The Elastic COBOL Integrated Development Environment (IDE) is based on the industry-leading Eclipse platform. Eclipse offers developers a truly extensible and configurable toolset that provides a consistent experience on multiple platforms, seamless support for multiple languages, and a powerful support community.

    Elastic COBOL compiles applications so that they execute natively within a Java runtime environment. This means your COBOL applications can immediately leverage the benefits of this proven enterprise platform, such as additional libraries, portability, performance, scalability & system management.

    Trademarks

    IBM is a registered trademark of International Business Machines Inc.

    Oracle and Java are registered trademarks of Oracle and/or its affiliates.

    UNIX is a registered trademark licensed exclusively to X/Open Company Limited.

    Linux is a registered trademark of Linus Torvalds.

    Windows is a registered trademark of Microsoft Corporation.

    Eclipse is a trademark of the Eclipse Foundation Inc.

    Other names may be trademarks of their respective owners.

  • Elastic COBOL Getting Started Guide 4

    Integrated Development Environment

    The Elastic COBOL Integrated Development Environment (IDE) is the graphical framework used by Elastic COBOL programmers to edit, compile, debug, deploy and execute programs. The Elastic COBOL IDE has been developed by Heirloom Computing based on the IBM Eclipse Platform.

    Installing & Starting the Elastic COBOL IDE

    Elastic COBOL Requirements (READ ME)

    If you intend to install Elastic COBOL on your machine, you must install the Java Development Kit (JDK) before you install Elastic COBOL.

    NOTE: If you have a 32-bit version of Elastic COBOL, you must install a 32-bit JDK. If you have a 64-bit version of Elastic COBOL, you must install a 64-bit JDK.

    Select the JDK Standard Edition from:

    http://www.oracle.com/technetwork/java/javase/downloads/index.html

    Download and install the JDK for your system. The JDK also includes a copy of the Java Runtime Environment (JRE) which is used by both the Eclipse Platform and Elastic COBOL applications.

    The recommended Eclipse Platform for Elastic COBOL is the Indigo (or later) distribution of the Eclipse IDE for Java EE Developers and can be found here:

    http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/indigor

    This (or a later version) is already included in the Elastic COBOL product download, and also in the hosted version in the cloud.

    Licensing

    Elastic COBOL is protected by a cloud-based licensing mechanism. This means that periodically (dependent on your subscription type), you must have an active network connection for the product to continue to operate.

    Because the licensing mechanism resides in the cloud, this means that it is not necessary to install any licensing software on your installation machine.

    When you purchase a subscription to download Elastic COBOL, you will be provided with a file called elasticcobol.properties. This file must be placed in the users home directory. e.g. C:\users\elastic.bot\elasticcobol.properties (or /usr/elastic.bot/elasticcobol.properties on Linux/UNIX).

  • Elastic COBOL Getting Started Guide 5

    Eclipse Perspectives

    Elastic COBOL is installed as a plugin of the Eclipse Platform. As such it creates an Elastic COBOL perspective, which is a visual container for a set of views and editors. The Eclipse Platform supports many different perspectives for different tasks, and Elastic COBOL can be used to seamlessly interoperate with different perspectives when building composite applications (e.g. a web application consisting of a browser interface and a COBOL server).

    Using this Guide

    Within each section, there are a set of suggested actions that you should take to get the most from the content. These actions are identified as:

    Perform the action described in this text.

    Alternatively, perform this action described in this text.

    Cloud (Hosted)

    Sign in to the management portal at: https://www.elasticcobol.com/index.php/sign-in

    If instance is not on, click Power On for the instance you want to start.

    Click Connect on the instance you want to activate.

    Enter your credentials. These are the same as your management portal credentials.

    Click OK and you will see the Elastic COBOL product banner which will then proceed to load the Elastic COBOL IDE.

  • Elastic COBOL Getting Started Guide 6

    Windows & Linux/UNIX (Open Systems)

    There are 2 ways to install Elastic COBOL on Open Systems. You can select your preferred method for installation via the product package that you downloaded.

    You can choose to install your product as:

    A full install which contains the Eclipse Platform and the Elastic COBOL IDE. This is best if you do not already have the required Eclipse Platform installed on your machine, or if you want to create an Eclipse install that is isolated from any other Eclipse installation.

    A plugin install (over the network) which contains just the Elastic COBOL IDE. This is best if you intend to install Elastic COBOL into an existing Eclipse installation (please ensure your Eclipse installation meets the requirements of Elastic COBOL).

    Full Install

    Open the ecobol-YY.MM.DD-[win|lnx]-[x86|x86_64].zip file and extract the contents to a folder location of your choice on your computer (e.g. C:\elasticcobol on Windows, or /usr/share/elasticcobol on Linux/UNIX).

    You can start the IDE by simply running the eclipse executable in your elasticcobol folder. You may prefer to create a shortcut to the eclipse executable and use that to load the Elastic COBOL IDE.

    Plugin Install

    Load your existing Eclipse IDE.

    Select Help Install New Software from the IDE menu.

    Enter http://elasticcobol.com/downloads/updates in the Work with: text-box and click Add.

    Select Heirloom Elastic COBOL Developer products on the Available Software dialog and click Next.

    Click Next on the Install Details dialog.

    On the Review Licenses dialog, select I accept the terms of the license agreements and click Finish.

    If a Security Warning about unsigned content appears, click OK.

    Click Restart Now on the Software Updates dialog.

  • Elastic COBOL Getting Started Guide 7

    Starting the Elastic COBOL IDE for the first time

    NOTE: If you are using the cloud version of the IDE, your IDE is already pre-configured and your default workspace will contain pre-loaded samples. To follow

    this guide, switch to a new workspace (File Switch Workspace Other).

    Your installation of Elastic COBOL is now complete. To start the Elastic COBOL perspective, follow these steps in the Eclipse IDE:

    Start the Eclipse IDE.

    If you are asked to select a workspace, do so, and click OK. D:\workspace is used as the default workspace reference in this manual

    The Eclipse Platform supports multiple workspaces. You can easily switch between

    workspaces when you start Eclipse, or via the File Switch Workspace menu inside Eclipse.

    If displayed, close the Welcome page by clicking on the tab.

    Select Window Open Perspective Other from the IDE menu.

    Select Elastic COBOL in the Open Perspective dialog and click OK.

    Introduction

    The Eclipse Platform is highly configurable and supports multiple views (windows) in multiple configurations. This manual will describe and refer to only the default views and configuration, but you can easily customize your environment based on your own requirements and preferences.

  • Elastic COBOL Getting Started Guide 8

    Once loaded, the Elastic COBOL IDE will look very similar to the above image.

    The Navigator view displays your workspace. It is currently empty because no projects have been created.

    The Editor view is activated when a project artifact is loaded for editing.

    The Problems view lists any warnings or errors produced by compiling the projects in your workspace will be displayed here.

    Elastic COBOL Toolbar

    The Elastic COBOL IDE has a number of primary actions incorporated as toolbar icons. From left to right, these are:

    Create a COBOL Project

    Create a COBOL Program

    Create an Elastic Transaction Platform Project

    Initiate a Debug Session

    Run an application

  • Elastic COBOL Getting Started Guide 9

    Creating a New Elastic COBOL Project

    A project is a collection of artifacts that are developed to create a functional application.

    The sample program used in this section of the manual consists of 2 artifacts 1 COBOL program and 1 Java program. The application function consists of the COBOL program calling the Java program with a set of parameters.

    On the toolbar, click to create a new COBOL project. You can also access this function via the File New COBOL Project menu.

    Name the project by entering co2ja as the project name.

    In the Project type pane, expand Samples, select COBOL calling Java and click Finish.

    The Navigator view now contains the co2ja project.

  • Elastic COBOL Getting Started Guide 10

    General Project Properties

    The co2ja project can be run immediately with the default set of project properties.

    Project properties by default are global in nature but program specific properties can be also set as local so that they only apply to individual program modules. Program specific properties can be very helpful in those instances where a particular or unique compiler characteristic must be set.

    To access the project properties, right-click on the root of the co2ja project tree and then select Properties from the context menu.

    COBOL Compiler Settings

    Select COBOL Compiler Settings.

    The Cobol Compiler Settings define the parameters to be used by the Elastic COBOL compiler during program compilation. By selecting Category you can review & modify all the different types of compiler options that can be set from this dialog.

  • Elastic COBOL Getting Started Guide 11

    COBOL Execution Settings

    Select COBOL Runtime Settings.

    The COBOL Runtime Settings are a set of configuration parameters that change execution characteristics of all application modules in a particular project. For example, you can change the color and font used for applications that use the character console.

    It is also possible to set these configuration parameters on an individual program

    basis via the Run Run Configurations menu. After selecting the COBOL program, select the Runtime tab and uncheck the Use global runtime execution settings.

    Click OK to close the Properties dialog.

    Managing Application Artifacts

    Creating a New Program

    New program units for your project can be created by selecting your project in the

    Navigator view and then clicking on the toolbar.

  • Elastic COBOL Getting Started Guide 12

    A template can be specified that will provide an initial coding structure. You can also choose your source code format preference (fixed, free or variable).

    Adding Existing Artifacts to a Project

    Additional artifacts can be added to a project by using the Import Wizard and specifying the program identifier information. Alternatively, you can simply drag &

    drop them into the appropriate folder in the Navigator view.

  • Elastic COBOL Getting Started Guide 13

    Editing, Compiling and Running a Project

    Incremental Compilation

    The Elastic COBOL IDE will incrementally compile your project when the project, or changes to the project artifacts, are saved. This enables your project to be in a current state during its development lifecycle.

    The incremental compile feature can be disabled by via the Windows Preferences menu. On the resulting dialog, you can then deselect Build automatically. If deselected, all project builds must be initiated manually.

    Compilation Messages

    In the Navigator view, expand co2ja and expand cobol_source.

    Right-click on calljava.cbl, and select Open on the context menu.

    Enter tmp in the calljava.cbl Editor view and click to save.

  • Elastic COBOL Getting Started Guide 14

    During compilation, which generally occurs automatically (unless unset in the preferences as above) upon any file import or modification, the compiler may generate error messages with one of three severity levels (error, warning &

    information). These messages will be listed in the Problems view.

    To correct an error, click on the relevant message in the Problems view. If possible, the editor will be positioned at the error. Any changes that are saved are

    recompiled and the Problems view is refreshed with the results.

    Move the cursor in the calljava.cbl Editor view to a different line than where the error is.

    In the Problem view, expand Errors (1 item), right-click on the error (Identifier not declared) and select Go To. This repositions the cursor on the line immediately after the error.

    Delete tmp from the source file and click on the toolbar to save.

    Program Execution

    In the Navigator view, expand java_source and double-click ShowParams.java to open the program file.

    Click the calljava.cbl editor tab in the Editor view to switch focus back to the COBOL program.

  • Elastic COBOL Getting Started Guide 15

    In the Navigator view, right-click on calljava.cbl and select Run As COBOL Application.

    Alternatively you can execute the program by selecting calljava.cbl in

    the Navigator view and clicking on the toolbar.

    Any console output from the executing application will be displayed in the Console view, which will be automatically activated.

    Elastic COBOL File and Record Servers

    The Elastic COBOL File Server provides access to files on the host server when the execution environment is implicitly constrained. For development & testing, the File

    Server can be started within the Elastic COBOL IDE via the Tools Start File Server menu.

    The Elastic COBOL Record Server provides record locking for indexed files. This

    can also be started within the Elastic COBOL IDE via the Tools Start Record Server menu.

  • Elastic COBOL Getting Started Guide 16

    Debugging in Elastic COBOL

    Elastic COBOL applications may be deployed across a broad range of systems, and the Elastic COBOL debugger supports local and remote debugging scenarios, including the debugging of applications deployed under a web application server.

    Debug Overview

    Application debugging provides a source level debug capability in the programming language that the application was written. The Elastic COBOL debugger displays COBOL source statements and COBOL variables. The debugger allows you to step through the program (from COBOL statement to the next COBOL statement) and examine the contents of COBOL data items.

    Setting Breakpoints

    Move the cursor in the calljava.cbl Editor view to the line with the last statement of the program.

    Double-click the line in the left most column. The appearance of a blue circle confirms the breakpoint has been set.

    Click the ShowParams.java editor tab in the Editor view to switch focus to the Java program.

    Enter Ctrl + F to invoke the Find/Replace tool, and enter return new in the Find: text-box, followed by clicking Find. Click Close.

    Double-click the found line in the left most column. The appearance of a blue circle confirms the breakpoint has been set.

    Starting a Debug Session

    Elastic COBOL applications are always ready to be debugged. You do not need to specify any compiler or runtime parameters for your application.

    In the Navigator view, right-click on calljava.cbl and select Debug As COBOL Application.

    Alternatively, you can select the pull-down menu from the toolbar and select calljava.cbl.

    Click Yes on the Confirm Perspective Switch dialog. You also have the option to remember this selection if you do not want to see this dialog again.

  • Elastic COBOL Getting Started Guide 17

    Once loaded, the Elastic COBOL debug perspective will look very similar to the above image.

    The Debug view is where you control the stepping and execution of your application. It displays the stack frame for the suspended threads for each target you are debugging. Each thread in your application appears as a node in the tree.

    The Variables view displays information associated with the stack frame selected in the Debug view. Variables can be selected to have more information displayed. The Breakpoints view can be selected to list all the breakpoints that you currently have set in your workspace.

    You can use the Editor view in the same way as you would in the Elastic COBOL perspective.

    The Console view is where any character system output from the executing application is displayed.

  • Elastic COBOL Getting Started Guide 18

    Using the Debugger

    The primary controls for the debugger can be found on top of the

    Debug view. Each of these primary controls act against the currently selected stack frame. For example, the current stack frame in the picture below is calljava: MAIN-PARAGRAPH.

    Resume (F8)

    Terminate Debug (Ctrl + F2)

    Step Into (F5)

    Step Over (F6)

    Reset debugging at start

    Use step filtering

    Variables View

    The Variables view provides a structured display of any variables used within the COBOL program that is being debugged. Selecting a variable in this view will display its contents & formatting information.

    In the Variables view, expand this & then expand wrk, and select item_1_OF_param_3 (this is the 05 item-1 data item of the 01 param-3 group data item).

  • Elastic COBOL Getting Started Guide 19

    Query Variables via Hover Over

    The contents of variables can be immediately shown by hovering the mouse pointer over the variable. If you want to see the content of a specific item in an array or a non-unique variable name in a group (e.g. ITEM1 OF GROUP2), first select the construct and then hover over it.

    Breakpoints View

    Select the Breakpoints tab to display the view.

    The Breakpoints view will list all of the breakpoints that are set in the workspace. In other words, breakpoints from all applications are listed, not just the ones from the application stack frame that is currently being debugged.

    You can activate/deactivate the breakpoints for the debugging session by toggling the check-box.

  • Elastic COBOL Getting Started Guide 20

    Debugging Composite Applications

    Elastic COBOL supports debugging of composite applications within the Eclipse Platform (for example, COBOL and Java programs). Debugging an application is done at the source level and will automatically switch between COBOL and Java source when those statements are executed or a breakpoint is activated.

    Click (or F6) a few times to see the execution stepping.

    Click (or F8) to resume execution of the application.

    The debugger encounters the breakpoint that was set in the Java program Showparams.java, automatically displays the source code and suspends execution.

    Click (or F8) to once again resume execution of the application.

    The debugger encounters the breakpoint that was set in the COBOL program calljava.cbl, automatically displays the source code, and suspends execution.

    Click (or F8) to once more resume execution of the application.

  • Elastic COBOL Getting Started Guide 21

    In the image above the debugger has completed execution of the application. The

    notification of this appears in the Debug view.

    Remote Debugging

    With remote debugging you can attach the Elastic COBOL debugger to an application executing on a different machine over the network. The application source code needs to be available on the same machine as the debug session, but the source code does not need to be on the remote machine.

    For simplicity, the illustration in this manual will show how to do this on the same machine via the http://localhost URL (i.e. by establishing a network connection between 2 processes on the same machine).

    To setup an application for remote debugging it is necessary to deploy the application using the Elastic COBOL Deploy Wizard. Application deployments are covered in more detail later in this manual, but for now follow these steps:

    Switch back to the Elastic COBOL perspective by clicking the Elastic COBOL button located at the top right of the IDE.

    In the Navigator view, right-click on the root of the co2ja project tree and then select Export from the context menu. In the Export dialog, expand Elastic COBOL, select Elastic COBOL Deploy Wizard and click Next.

  • Elastic COBOL Getting Started Guide 22

    Enter d:\tmp\co2ja.jar (or /tmp/co2ja.jar on Linux/UNIX) in JAR or WAR file: text-box and click Next.

    Click the Run Configuration: pull-down and select calljava.cbl. The Main Class: area is automatically updated with the main entry point.

    The COBOL Deploy Wizard dialog should now look like the image below. Check Generate script-based application launcher stub and click Finish.

    Start a command console on your system and if on Windows, enter d: to change drive and enter cd \tmp to change directory (or cd /tmp on Linux/UNIX).

    NOTE: If using the cloud version of the IDE, in the Navigator view, right-click on Other-Tools.html (in the [Welcome] project), and select Open.

    In the Other Tools window, click on Start Command Console.

    If it appears, click Yes on the Windows Security Warning dialog to start Command Console.

  • Elastic COBOL Getting Started Guide 23

    Execute the co2ja_debug_remote script. Depending on your system, this will either have a .bat (Windows) or .sh extension (Linux/UNIX). The application is now suspended, awaiting a connection from a debugger.

    We now need to create a debug configuration to attach the debugger to the suspended application. In the IDE, select Run Debug Configurations, and click Remote COBOL Application in the Debug Configurations dialog.

    Click on the toolbar to create a new debug configuration.

    In the Debug Configurations dialog, enter co2ja in both the Name: text-box and the Project: text-box. Click Apply.

    Click Debug, and click Yes on the Confirm Perspective Switch dialog (if it appears).

    The debugger encounters the first breakpoint that was set in the Java program Showparams.java, and suspends execution.

    Switch back to the command console where the application was launched. As expected, the output from the application is displayed on this console.

    In the IDE click (or F8) to resume execution to the second breakpoint that

    was set in the COBOL program, and then click (or F8) again to resume execution to the end of program. At this point, the execution of your application in your command console will have completed.

  • Elastic COBOL Getting Started Guide 24

    If the application was on a different machine then the address in Host: would be the host name or IP network address of that machine. As long as there is a network connection to the machine running the remote application, you can initiate a debugging session for that application.

  • Elastic COBOL Getting Started Guide 25

    Application Deployment

    Deployment Overview

    Elastic COBOL supports multiple deployment scenarios. Depending on the application architecture, applications can be packaged for deployment via the Elastic COBOL Deploy Wizard as:

    JAR Java application archive (.jar file)

    o These applications are typically loaded and executed directly by the Java runtime (e.g. from the command line: java -jar myapp.jar).

    WAR Web application archive (.war file)

    o These applications are typically deployed under the control of a Web Application Server (such as Apache Tomcat). They are executed via a URL associated with the Web Application Server.

    Or via the Elastic Transaction Platform Deploy Wizard as:

    EAR Enterprise application archive (.ear file)

    o Used when the application being deployed uses CICS transactions.

    o These applications are typically deployed under the control of an Enterprise Application Server (such as Apache Geronimo). They are executed via a URL associated with the Enterprise Application Server.

    Depending on your requirements you can also choose to create any of the above package types (manually or via your own custom scripts) without using the wizards.

    When using the wizards, the runtime services, as well as any other resources, required by the application are packaged along with the application itself. The runtime services are presented as modular packages which you can opt to include or exclude from the final package (i.e. not all of the runtime services may be required to execute your application).

    Java Runtime Environment (JRE)

    Deployed applications require a JRE to execute. The JRE is also commonly referred to as the Java Virtual Machine (JVM) and provides an execution framework that is platform independent. The JRE must be installed on the target machine. JREs for many platforms can be downloaded from here:

    http://www.java.com/en/download/index.jsp

    If a JRE for your platform is not available from here, you will need to locate it via your platform (i.e. hardware or operating system) providers website. For JREs from the java.com website, you can check the version from your command line console by entering:

    java version

  • Elastic COBOL Getting Started Guide 26

    You should validate that your application behaves as expected against all of the JREs and platforms that you want to support, but generally speaking, applications will run as expected on JREs that have the same (or later) version of the JRE that you tested your application on (and on any platform assuming that you do not have platform-specific code in your application).

    Using the Export (Deploy) Wizards

    Switch back to the Elastic COBOL perspective by clicking the Elastic COBOL button located at the top right of the IDE.

    On the toolbar, click to create a new COBOL project. Enter screen as the project name.

    In the Project type pane, expand Samples, select Text Screen and click Finish.

    In the Navigator view, click on the triangle for co2ja to collapse the project view.

    Click on the triangle to expand screen, and then expand cobol_source. Double-click screens.cbl to open it in the Edtior view.

    As you can see, it is very easy to work on multiple projects in the Elastic COBOL

    IDE. The Navigator view presents a single view of all projects in your workspace.

  • Elastic COBOL Getting Started Guide 27

    The screens.cbl application is an example of a simple console application that can be deployed as a standalone application.

    In the Navigator view, right-click on screens.cbl, select Run As and COBOL Program.

    Click on the top-right of the Screens application to close it. By executing the application we have automatically created a default Run Configuration that we are going to use in the deployment process.

    In the Navigator view, right-click on the root of the screen project and select Export.

    Expand Elastic COBOL, select Elastic COBOL Deploy Wizard, and click Next.

  • Elastic COBOL Getting Started Guide 28

    In the JAR or WAR file: text-box, enter d:\tmp\screen.jar (or /tmp/screen.jar on Linux/UNIX), and click Next.

  • Elastic COBOL Getting Started Guide 29

    By default, the wizard includes all available runtime modules. These will be included in the executable packages created by the deploy wizard. You can reduce the disk and memory footprint of your application by excluding runtime modules that you know are not required.

    Click the Run Configuration: pull-down and select screens.cbl. The Main Class: area is automatically updated with the main entry point.

    Select the Other Options: as in the image above, and click Finish.

  • Elastic COBOL Getting Started Guide 30

    Depending on the settings selected, the Elastic COBOL Deploy Wizard will generate scripts and packages that can be used to load & execute the exported application. For example:

    screen.jar can be executed from the command line using java -jar screen.jar or deployed & executed under a Web Application Server

    screen.bat (or screen.sh) can be executed directly from the command line

    screen.html can be executed by loading the file from within a browser

    screen.war needs to be deployed & executed under a Web Application Server

    screen.ear needs to be deployed & executed under an Enterprise Application Server

    Note that any external files other than application artifacts, such as sequential, relative, indexed files or databases, will always be separate from the exported packages.

    Standalone Applications

    Console Command Line

    Start a command console on your system and if on Windows, enter d: to change drive and enter cd \tmp to change directory (or cd /tmp on Linux/UNIX). You can find the output of the deploy wizard in this folder.

    NOTE: If using the cloud version of the IDE, in the Navigator view, right-click on Other-Tools.html (in the [Welcome] project), and select Open.

    In the Other Tools window, click on Start Command Console.

    If it appears, click Yes on the Windows Security Warning dialog to start Command Console.

    From your command line console, enter screen.bat (or sh screen.sh on Linux/UNIX) to execute the application.

    Alternatively, you can execute the application by entering java -jar screens.jar.

    Enter some data and hit enter to exit.

    Installing Additional Software

    One of the major benefits of the Eclipse Platform is the availability of additional plugins that can significantly enhance your productivity as a developer. This is a list of suggested plugins that you may want to install to enhance the functionality of the Elastic COBOL IDE:

    Apache Tomcat

    o Description: An open source web application server implementation of Java Servlet and JavaServer Pages.

  • Elastic COBOL Getting Started Guide 31

    o Relevance: Elastic COBOL applications can run as servlets, deployed under a web application server. Apache Tomcat integrates with the Eclipse Platform to provide a very fast & easy to use server for developing web applications in Elastic COBOL.

    o Location: http://tomcat.apache.org

    NOTE: If you are using the cloud version of the IDE, this step has already been done for you and you can move to the next section (Servlet Applications).

    Download and install Apache Tomcat from http://tomcat.apache.org follow the instructions on the website for your platform.

    In the Eclipse IDE, select File New Other from the IDE menu.

    In the Select a wizard dialog, expand Server, select Server and click Next.

    In the Define a New Server dialog, expand Apache, select Tomcat v7.0 Server (or other version), and click Next.

  • Elastic COBOL Getting Started Guide 32

    In the Tomcat Server dialog, click Browse, select the root directory of your Tomcat installation, and click OK.

    Click Finish. The Apache Tomcat server configuration can verified by expanding Servers in the Navigator view.

    In the IDE, select Window Show View Other.

    In the Show View dialog, expand Server, select Servers, and click OK.

    In the Servers view, right-click on Tomcat v7.0 Server at localhost [Stopped] and click Open.

    In the Editor view, select Use Tomcat installation under the Server

    Locations area, and click on the toolbar to save. This configuration, which should be for application development only, enables tight integration between Elastic COBOL projects and the Apache Tomcat web application server.

  • Elastic COBOL Getting Started Guide 33

    Servlet Applications

    A servlet is a Java application that executes on the server side of the network. Servlets extend the capability of the web application server and are accessed via a request-response programming model (very similar in concept to the pseudo-conversational model employed by CICS transactions).

    The sample program used in this section of the manual uses an HTML page to pass information to a COBOL servlet running under a web application server. The COBOL program then stores the data in a relative file and also generates an HTML page confirming the registration details.

    Building a Servlet Application

    On the toolbar, click to create a new COBOL project. Name the project by entering register as the project name. In the Project type pane, expand Samples, select Servlet Register and click Finish.

    In the Navigator view, click on the triangle for screen to collapse the project view.

    Click on the triangle to expand register, and then expand resources. Right-click register.html, select Open With Web Browser

  • Elastic COBOL Getting Started Guide 34

    Any project artifacts contained in the resources folder will be included in the deployment packages created by the Elastic COBOL Deploy Wizard.

    Edit the HTML file by right-clicking on register.html in the Navigator view and selecting Open With Web Page Editor.

    Enter My in the Editor view for register.html and click to save.

    Click on the Servers view to start Apache Tomcat.

  • Elastic COBOL Getting Started Guide 35

    Packaging & Deploying Servlet Applications

    A requirement of using the Elastic COBOL Deploy Wizard is for the project to be deployed to have a valid Run Configuration. Running an application will automatically create one, but in this example we will create it manually as

    there may be scenarios where you want to do this. In the Navigator view, click the root of the register project and then select Run As Run Configurations from the IDE menu.

    In the Run Configurations dialog, select COBOL Application in the left

    pane and then click on the toolbar to create a new Run Configuration.

    Enter register.cbl in the Name: text-box.

    The Project: text-box should already identify the register project, so to

    identify the Main program, click on the Search button, select register (default package) and click OK.

    Click Apply and then click Close.

    In the Navigator view, right-click on the root of the register project, and select Export.

    In the Export dialog, select Elastic COBOL Elastic COBOL Deploy Wizard and click Next.

  • Elastic COBOL Getting Started Guide 36

    In the JAR or WAR file: text-box, enter the location of your Tomcat server deployment folder C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\register.war (or C:\tomcat7\webapps\register.war if using the cloud version of the IDE, or /usr/share/tomcat7/webapps/register.war on Linux/UNIX), and click Next.

    Click the Run Configuration: pull-down and select register.cbl. The Main Class: area is automatically updated with the main entry point.

    Select the Other Options: as in the image above, and click Finish.

    Because we deployed directly into the Apache Tomcat deployment folder, the web application server will automatically deploy the register.war package. When this is done the Elastic COBOL IDE will automatically switch to the

    Console view to display the deployment message from Apache Tomcat.

  • Elastic COBOL Getting Started Guide 37

    In the Console view, click both of Show Console When Standard Out Changes and Show Console When Standard Error Changes to deselect them. This will now stop the Elastic COBOL IDE switching to the

    Console view when something displays a message to standard-out or standard-error.

    Executing Servlet Applications

    In the Editor view, select the Elastic COBOL Registration Sample web browser tab.

    In the web browsers address bar, enter http://localhost:8080/register/register.html. Because the web browser already had a copy of the form loaded from the local file system, it may appear that nothing much happened, but the form now displayed was loaded from the servlet application deployed under the web application server.

    Fill out the form. The fields that are identified in bold are required.

    Click the Register Software button on the form.

  • Elastic COBOL Getting Started Guide 38

    Debugging Servlet Applications

    Debugging a servlet application running under the web application server requires the configuration of a remote debugging session to be set up between the application and the server.

    In the Console view, click to terminate Apache Tomcat. The IDE will automatically switch to the Servers view to confirm that the server has terminated.

    In the Servers view, select Tomcat v7.0 Server at localhost [Stopped, Synchronized] and press F3. This will open the configuration page.

    In the Editor view, click Open launch configuration (under the General Information tab).

    In the Edit Configuration dialog, select the (x)= Arguments tab.

    In the VM arguments panel, enter -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n, and click OK.

  • Elastic COBOL Getting Started Guide 39

    Click on the Servers view to restart Apache Tomcat.

    The web application server is now configured for remote debugging. We now need to configure the application side of the debugging session. In the

    Navigator view, expand register and cobol_source. Double-click register.cbl to open the source file in the Editor view.

    Enter Ctrl + F to invoke the Find/Replace tool, and enter servlet-post in the Find: text-box, followed by clicking Find. Click Close.

    Double-click the next line with the PERFORM statement in the left most column. The appearance of a blue circle confirms the breakpoint has been set.

    Set another breakpoint on the first ACCEPT statement in the READ-

    DATA paragraph by double-clicking the line in the left most column.

    In the Navigator view, select the root of the register project, and then select Run Debug Configurations from the IDE menu.

  • Elastic COBOL Getting Started Guide 40

    Click Remote COBOL Application in the Debug Configurations dialog.

    Click on the toolbar to create a new debug configuration.

    In the Debug Configurations dialog, enter [DEBUG] register.cbl the Name: text-box, and click Debug.

    The application is now configured for remote debugging. The next step is to execute the application in the same way as we have already done. In the

    Editor view, select the Product Registration Received web browser tab,

    and click on the browser toolbar to go back to the previous page.

    Go to the bottom of the web page, and click the Register Software button.

    A Debugger Source Lookup dialog may appear. If so, select Do not ask again and click OK.

    If the Confirm Perspective Switch dialog appears, click Yes and the debugger perspective will automatically load. The program will suspend execution when the first breakpoint is encountered (at PERFORM READ-DATA).

    In the Variables view, expand this, expand wrk and select city_OF_work_record. In the content window below the Variables view you will see that this variable is currently empty.

  • Elastic COBOL Getting Started Guide 41

    Click (or F6) to step over the perform statement. The program will suspend execution when the next breakpoint is encountered (at ACCEPT). This is the start of the code that reads the data that has been posted to the COBOL servlet from the web page form.

    Select the register.cbl tab in the Editor view.

    Enter Ctrl +F to invoke the Find/Replace tool, and enter notify-done in the Find: text-box, followed by clicking Find. Click Close.

    Double-click the next line with the EXEC HTML statement in the left most column. The appearance of a blue circle confirms the breakpoint has been set.

    Click (or F8) to resume execution of the servlet application. The debugger once again suspends execution when it encounters the next breakpoint. This is the start of the code in the COBOL servlet that generates the registration

    web page. In the Variables view, the variable city_OF_work_record now contains the data CITY that came from the submission of the web page form.

    Click (or F8) to once again resume execution of the COBOL servlet. At this point, the COBOL servlet has terminated. Select the Product Registration Received tab in the Editor view to see the registration web page created by the COBOL servlet.

  • Elastic COBOL Getting Started Guide 42

    Iterative Debugging, Development & Deployment

    With the web application server running, additional changes that you make to the servlet application you are developing can be easily redeployed to the web application server using the Elastic COBOL Deploy Wizard. As soon as a new .war package is exported to the Apache Tomcat deployment folder, it will automatically undeploy the currently installed version of the application and then deploy the new version.

    When debugging, to prevent having to stop/start the Apache Tomcat web application server, it is important to terminate the debug session in the proper way, otherwise the remote network connection between the debugger and application can sometimes fail to function as expected.

    To properly terminate the debug session for the servlet application, in the

    Debug view, scroll to the top of the process/thread list and locate the [DEBUG] register.cbl [Remote COBOL Application] process.

    Right-click on this process and select Terminate and Relaunch.

    In the Editor view, select the Product Registration Received web browser

    tab, and click on the browser toolbar to go back to the previous page.

    Go to the bottom of the web page, and click the Register Software button.

    A Debugger Source Lookup dialog may appear. If so select Do not ask again and click OK.

    To finish your debug session, scroll to the top of the process/thread list in the Debug view, right-click on the [DEBUG] register.cbl [Remote COBOL Application process and select Terminate and Remove.

    In the Terminate and Remove dialog, click Yes.

    Switch back to the Elastic COBOL perspective by clicking the Elastic COBOL button located at the top right of the IDE.

  • Elastic COBOL Getting Started Guide 43

    CICS Applications

    Overview

    Elastic COBOL supports the use of the Customer Information Control System (CICS) transactions via the Elastic Transaction Platform (ETP). ETP enables CICS COBOL applications to be deployed as Enterprise Java Beans (EJB) so that they can be executed within the Java Enterprise platform.

    Creating a CICS COBOL Project

    When building a CICS COBOL application for ETP, the following resources may need to be configured:

    Journals a structured mechanism for writing to a sequential data store

    Templates HTML resources

    Queues for holding and accessing data in sequential order

    SQL information about the database connection

    File Definitions mapping of file record structures to SQL table

    Additional Software Requirements

    NOTE: If you are using the cloud version of the IDE, this step has already been done for you and you can move to the next section (Creating an ETP Project Part 1).

    ETP projects generate EJBs for transactions, so a JEE Application Server is required to execute the application. Native file access is not permitted within a JEE environment and so ETP projects require a relational database for data storage.

    Download and install Apache Geronimo (with Tomcat) from http://geronimo.apache.org/apache-geronimo-v300-release.html follow the instructions on the website for your platform.

    Download and install Oracle Database 11g Express Edition from http://www.oracle.com/technetwork/database/express-edition/downloads/index.html follow the instructions on the website for your platform.

    In the Eclipse IDE, select File New Other from the IDE menu.

    In the Select a wizard dialog, expand Server, select Server and click Next.

    In the New Server dialog click Download additional server adapters.

    In the Install New Extension dialog, select the Geronimo v3.0 Server Adapter and click Next.

  • Elastic COBOL Getting Started Guide 44

    Click I accept the terms of the license agreement in the Review Licenses dialog and click Finish.

    Click OK on the Install Extension dialog.

    If you are asked to trust an Apache Geronimo certificate, select it and click OK.

    In the Software Updates dialog, click Yes to restart the IDE.

    Setting up the Application Server

    When the Eclipse IDE restarts, select File New Other from the IDE menu.

    In the Select a wizard dialog, expand Server, select Server and click Next.

    In the Define a New Server dialog, expand Apache, select Apache Geronimo 3.0 Server, and click Next.

  • Elastic COBOL Getting Started Guide 45

    In the New Apache Geronimo dialog, click Browse, select the root directory of your Geronimo installation, and click OK.

    Click Finish. The Apache Geronimo server configuration can verified by selecting the Servers view.

  • Elastic COBOL Getting Started Guide 46

    Creating an ETP Project Part 1 Application Project

    When creating a new ETP project in Elastic COBOL, use the Create a COBOL Project Wizard and select Compatibility Elastic Transaction Platform Template. This will ensure that the right compiler options are set; otherwise EXEC TRANSACTION or EXEC CICS statements will not be recognized by the Elastic COBOL compiler.

    We are going to use the ETP Account sample application, but before we start lets clean up our IDE workspace. In the Editor view, right-click any of the tabs and select Close All.

    In the Navigator view click on the toolbar to collapse all the projects.

    On the toolbar, click to create a new COBOL project.

    Name the project by entering account as the project name.

    In the Project type pane, expand Samples, select ETP Account and click Next.

    Because ETP projects require a relational database for data storage, the project needs to be configured to locate the JDBC driver and setup SQL compiler options.

    In the Navigator view, right-click on the root of the account project, and select Properties Java Build Path Libraries, and click Add External JARs.

    In the Java Settings dialog, select the Libraries tab, Locate the Oracle JDBC driver ojdbc5, click Open and then click Finish on the Java Settings dialog.

  • Elastic COBOL Getting Started Guide 47

    In the Navigator view, click on the triangle to expand account, then expand cobol_source, copylib, and resources.

    Right-click on the root of the account project tree and then select Properties from the context menu.

    In the Properties for account dialog, select COBOL Compiler Settings and SQL from the Category: pull-down.

    Select Oracle from the SQL Mode: pull-down, select CHARF from the PIC X(n): pull-down, and select JDBC 2.x from the JDBC: pull-down.

    Click OK to finalize the settings, and click No on the Compiler Settings Changed dialog to prevent a rebuild of the project (it is not necessary yet).

    CICS COBOL applications that have terminal interfaces almost always use Basic Mapping Support (BMS) to move data streams between CICS and the COBOL application. Elastic COBOL can generate a symbolic map so that the COBOL program can directly refer to the display fields contained within a BMS file.

    In the Navigator view, right-click on resources/ACCTSET.bms and select Elastic COBOL BMS Generate Copyfile. This generates the symbolic map for the COBOL program.

  • Elastic COBOL Getting Started Guide 48

    Because, ETP projects are deployed to a Java Enterprise Application Server, they are typically accessed via an internet browser, so Elastic COBOL has a facility to generate HTML files from the BMS maps. These HTML files can then be used as the user-interface to the deployed COBOL program.

    In the Navigator view, right-click on resources/ACCTSET.bms and select Elastic COBOL BMS Generate HTML.

    Select Project Clean from the IDE menu.

    In the Clean dialog, select only account, select Clean projects selected below, and click OK. At this stage, the project should compile cleanly (i.e. no major errors listed in the Problems view).

  • Elastic COBOL Getting Started Guide 49

    Data Migration (VSAM to Relational)

    CICS COBOL applications that use native file-systems (such as VSAM) must migrate these data stores to a relational database so that the application can execute within a Java Enterprise platform. To assist with this, Elastic COBOL has a facility that can generate an XML file from a COBOL record descriptor. This XML file can then be used by ETP to access SQL columns in a table.

    In the Navigator view, right-click on ACCT01.cbl and select Open.

    Enter Ctrl + F to invoke the Find/Replace tool, and enter $XFD in the Find: text-box, followed by clicking Find. Click Close.

    Remove the * from the left-most column and click to save. The Elastic COBOL compiler produces a file called ACCTFIL.XML (placed in the listing folder) which is an XML representation of the ACCTREC-SQL.cpy copyfile (which is the record layout for the VSAM file). This is the same layout as ACCTREC.cpy, but the data names have been changed to be more descriptive (e.g. FIRST-NAME rather than FNAMEDO). These names will become the names for the SQL columns in the relational data store.

    In the Navigator view, drag & drop ACCTFIL.XML from the listing folder to the resources folder.

  • Elastic COBOL Getting Started Guide 50

    We need to identify any primary and alternate keys for the VSAM file so that we can mark them as such in the XML representation of the file record.

    Click File Refresh to synchronize the project files before doing a search.

    From the IDE menu, click Search File. Enter read dataset into the Containing text: text-box on the Search dialog. Click Search.

    In the Search view, double-click on the first result (line 833 in the image above). In the Editor view, this shows:

    EXEC CICS READ DATASET (ACCTFIL) RIDFLD(ACCTC) INTO(ACCTREC)

    The primary key for the VSAM file is the data item ACCTNO (this is the value that is moved into ACCTC elsewhere in the program), and this is accessed with ACCTFIL (which we have already created but need to edit to mark the key field).

    In the Search view, double-click on the third result (line 871 in the image above). In the Editor view, this shows:

    EXEC CICS READ DATASET (ACCT-PATH-NAME) RIDFLD(NAME2C) INTO (ACCTREC)

    The alternate key for the VSAM file is the group data item NAME (this is the value that is moved into NAME2C elsewhere in the program), and this is accessed with ACCT-PATH-NAME (which we need to create and edit to mark the key field).

    For the primary key:

    In the Navigator view, right-click on ACCTFIL.XML and select Open. If necessary, click the Design tab on the bottom of the Editor view for ACCTFIL.XML.

    Expand group and then expand the first column (the first attribute is name with a value of acctno).

    Right-click on column and select Add Attribute New Attribute.

    In the New Attribute dialog, enter ridfld in the Name: text-box, enter dupcheck in the Value: text-box, click OK, and then

    click to save.

  • Elastic COBOL Getting Started Guide 51

    For the alternate key:

    We first need to create a file called ACCT-PATH-NAME.XML (to correspond to the EXEC CICS READ statement. In the

    Navigator view, right-click on ACCTFIL.XML and select Copy.

    In the Navigator view, right-click on the resources folder and select Paste.

    In the Name Conflict dialog, enter ACCT-PATH-NAME.XML in the text-box and click OK.

    In the Navigator view, right-click on ACCT-PATH-NAME.XML and select Open. If necessary, click the Design tab on the bottom of the Editor view for ACCT-PATH-NAME.XML.

    Expand group and then expand the first column (the first attribute is name with a value of acctno).

    Right-click on ridfld and select Remove.

    Expand the next group (the first attribute is name with a value of name).

    Right-click on group and select Add Attribute New Attribute.

  • Elastic COBOL Getting Started Guide 52

    In the New Attribute dialog, enter ridfld in the Name: text-box, enter dupcheck in the Value: text-box, click OK, and then

    click to save.

    Resolving Port Conflict

    NOTE: If you are using the cloud version of the IDE, this step has already been done for you and you can move to the next section (Setting up the Relational Database).

    Unless you specified otherwise, by default, the HTTP listener for Oracle XE database will have been installed on the same port as the Apache application servers (i.e. 8080). To avoid this conflict:

    Start a command console on your system, enter sqlplus system and enter the password (that you setup when you installed the database).

    In the SQL Command Console, enter:

    SQL> begin dbms_xdb.sethttpport(8081); end; [enter]

    / [enter]

    PL/SQL procedure successfully completed.

    SQL> quit [enter]

  • Elastic COBOL Getting Started Guide 53

    Setting up the Relational Database

    NOTE: If you are using the cloud version of the IDE, the database has already been configured for you so you can move to the next section (Creating and ETP Project Part 2).

    In the Navigator view, right-click on ACCTSET_ACCTDTL.html, select Open With Web Browser (we are only doing this to quickly load the internal browser in the Editor view).

    In the address bar, enter http://localhost:8081/apex/f?p=4950. This will load the initial console for the Oracle Express Database.

    In the Oracle Express Database window, click on Application Express.

    Enter the username (e.g. system) and the password that you set the database up with when you installed it; and click Login.

    In the Create Application Express Workspace window, enter ACCTUSER in the Database Username text-box, enter account in the Application Express Username text-box, and enter acctpassword in both the Password and Confirm Password text-boxes.

    Click Create Workspace.

  • Elastic COBOL Getting Started Guide 54

    Once the workspace has been created, you will see the following message appear. Click click here to login.

    On the login screen, enter acctpassword and click Login.

    We are now going to load the application data into the database. Click the SQL Workshop box, click the SQL Scripts box, and then click the Create > button.

    In the Navigator view, right-click on oracleXE-acctfil.sql, and select Open.

    NOTE: This script creates a database table that represents the layout of the COBOL data files, and records that contain the same data as the original COBOL indexed-sequential data file. In this application the script is provided for you.

    In the Editor view for this script, click CTRL-A to select all the text and click CTRL-C to copy it.

    In the Editor view, click the Script Editor tab to return to the script edit window.

    Enter acctfil in the script name text-box.

    Click inside the script edit window, and click CTRL-C to paste the script in to the editor.

    Click the Save button (located at the top right of the page).

    Click the Traffic Light icon, and then click the Run Now button to execute the script.

    The database is now populated with the applications dataset. Optionally, you can click on the icon below View Results to see the output from running the script. Here, you will see 1 Error which is the result of a request to unload a database called ACCTFIL (on the chance that one already exists).

  • Elastic COBOL Getting Started Guide 55

    Creating an ETP Project Part 2 Deployment Project

    Elastic COBOL uses a separate project to configure and manage the deployment of an ETP project. Some of the items configured in an ETP Deployment Project include things like participating projects, transaction to program-id mappings and database connection information.

    In the Elastic COBOL IDE, click to create a new Elastic Transaction Platform Project.

    In the Elastic Transaction Platform Project dialog, enter account-deploy in the Project name: text-box, and click Finish.

    Elastic COBOL will automatically open the ETP Deploy Settings in the Editor view. In the General category, enter acct in the SYSID: text-box, select account as the Participating project on the Properties pane, and click Apply.

    Click Programs in the Categories pane and you will see that the COBOL CICS applications have been automatically populated.

    We now need to associate the CICS transaction IDs with COBOL program IDs. Click Transactions in the Categories pane. The initial transaction ID is always init and this should be associated with the first program that needs to be run for the application.

    In the Transactions pane, click Add.

    In the Add dialog enter init in the Transaction ID: text-box, select acct00 from the Program ID: pull-down, and click OK.

    We must associate a program ID with a transaction ID for every CICS RETURN statement. From the IDE menu, click Search File. Enter return transid into the Containing text: text-box on the Search dialog. Click Search.

    In the Search view, click to expand all search results. From the list, we need to associate program IDs with transaction IDs for AC01 (which is ACCT01.cbl) and AC02 (which is ACCT02.cbl).

    In the Transactions pane, click Add.

    In the Add dialog enter ac01 in the Transaction ID: text-box, select acct01` from the Program ID: pull-down, & click OK.

    In the Transactions pane, click Add.

    In the Add dialog enter ac02 in the Transaction ID: text-box, select acct02` from the Program ID: pull-down, & click OK.

    Click SQL in the Categories pane. This is where we enter the information necessary to establish the connection to the database. Click Add. In the Add dialog:

    Enter file in the Connection name: text-box.

    Enter acctuser in the Username: text-box.

  • Elastic COBOL Getting Started Guide 56

    Enter acctpassword in the Password: text-box.

    Enter jdbc:oracle:thin:@localhost:1521:xe in the Connection URL: text-box

    Enter oracle.jdbc.OracleDriver in the Driver classname: text-box.

    Click OK.

    Click File Control in the Categories pane. This is where we associate the VSAM file names to the XML files that contain the SQL column names:

    Click Add. In the Add dialog enter acctfil (which has the primary key) in the Source name: text-box.

    Enter jdbc:ACCTFIL.XML (this is case-sensitive) in the Destination name: text-box, and click OK.

    Click Add. In the Add dialog enter acct-path-name (which has the alternate key) in the Source name: text-box.

    Enter jdbc:ACCT-PATH-NAME.XML (this is case-sensitive) in the Destination name: text-box, and click OK.

    In the Editor view for ETP Deploy Settings, click Apply to save.

    You can review all the settings made by clicking the project.etp_deploy_settings tab in the ETP Deploy Settings editor.

  • Elastic COBOL Getting Started Guide 57

    Deploying an ETP Project

    In Elastic COBOL, ETP projects are deployed via the familiar mechanism of a deployment wizard. For ETP projects, this is the Elastic Transaction Deploy Wizard.

    In the Navigator view, right-click on the root of the account-deploy project, select Export Elastic COBOL Elastic Transaction Platform Deploy Wizard and click Next.

    In the ETP Deploy Wizard dialog, ETP Project: should be set to account-deploy. In the EAR file: text-box, enter the location of your Geronimo deployment folder C:\g3\deploy\account.ear (or /usr/share/g3/deploy/account.ear on Linux/UNIX).

    Click Finish.

    If a Confirm Create dialog appears, click Yes.

    Click OK on the Archive Export Problems dialog and click OK on the Export Successful dialog.

    Select the Servers view, select the Apache Geronimo v3.0 Server at

    localhost, and click to start the server. Because we deployed directly into the Apache Geronimo deployment folder, once the JEE application server has started, it will automatically deploy the account.ear package.

    You can monitor the progress of Apache Geronimo by selecting the Console view.

    To validate the application was successfully deployed, right-click on Apache Geronimo v3.0 Server at localhost [Started, Synchronized] in the Servers view, and select Launch Geronimo Console.

    In the Editor view for Geronimo, enter system in the User Name: text-box, enter manager in the Password: text-box, and click Login.

    In the Console Navigation pane, expand [+] Applications, and click Application EARs. The State for /acct should be running.

  • Elastic COBOL Getting Started Guide 58

  • Elastic COBOL Getting Started Guide 59

    Executing an ETP Application

    ETP Applications are invoked as servlets. This is a highly complementary model for COBOL CICS applications, which typically have a request/respond execution flow.

    From the Elastic COBOL IDE menu, select Window Show View Other.

    In the Show View dialog, select General Internal Web Browser, click OK.

    In the Internal Web Browser view, click to expand the window.

    In the address bar, enter http://localhost:8080/acct/servlet.

    In the application screen of account, enter GREEN in the SURNAME: text-box and click PF2 (the command for forward in this application). Because this is the initial load of the database there will be a few seconds delay before the results are displayed. Subsequent requests will typically be sub-second.

    Click PF1 (backward) or PF2 (forward) to scroll through the records.

    Other actions are permitted as per menu. Always click Clear before issuing a new request to the application.