Java and
COBOL The Documentation http://www.simotime.com |
When technology complements business | Copyright © 1987-2010 SimoTime Enterprises All Rights Reserved |
Introduction |
(Next) (Previous) (Table-of-Contents) |
This web application demonstrates the use of Java Server Pages (including JSP tags, HTML and JavaScript), Java Beans, Applets, Scriplets and COBOL programs working together in a mixed-language environment. The purpose of this suite of sample programs is to provide practical examples and possible solutions for individuals that will be creating Internet applications that may require complementary processing with a mainframe. This suite of sample programs also executes on an application server that functions independent of the mainframe.
For example, this application suite accesses a local data set that was downloaded from a mainframe in EBCDIC format. The program could make a connection to a Mainframe to access the data set that is a VSAM Keyed, Sequential Data Set (KSDS). An example of converting between ASCII and EBCDIC is also provided in the data access member.
This set of programs was created and/or downloaded from a mainframe system as a result of a "Discovery Session and Proof-of-Concept" project to determine the feasibility and possible approaches of extending mainframe application functionality to the Internet. The initial analysis reduced the focus to the following three possibilities.
1. | Continue with Business as usual. |
2. | Rewrite the application using Java. |
3. | Use Java for the Internet front-end and reuse as many of the existing COBOL programs as possible. |
One of the goals was to complete the "Discovery Session and Proof-of-Concept" within fifteen (15) days. This required a focus on a sampling of typical routines used in the mainframe application. Six functions were selected and the corresponding mainframe COBOL programs were downloaded from the mainframe to the PC.
The "Java Rewrite" numbers are estimates. The time estimates to rewrite exceeded the scope of the "Discovery Session and Proof-of-Concept". An attempt was made to access the data base for the "Customer Inquiry" function using Java. It was quickly determined that Java does not have native support for Indexed or Keyed files. Converting the data base to a relational data base was discussed. This is a possibility but was not included as part of this project.
Description of Function | Create JSP | Java API | COBOL Reuse | Java Rewrite |
Access a Data Base | 0.50 | 0.50 | 0.25 | 3.00 |
Write to a Journal or Log File | 0.75 | 0.50 | 0.25 | 1.50 |
Create a Text String from Numbers | 0.50 | 0.50 | 0.25 | 4.50 |
Date Validation-Conversion-Formatting | 0.50 | 0.75 | 0.25 | 5.00 |
Date Difference Routine | 0.50 | 0.50 | 0.25 | 2.00 |
Hex-Dump Routine for Debugging | 0.50 | 0.50 | 0.25 | 5.00 |
Total Number of Days | 3.25 | 3.25 | 1.50 | 21.00 |
Note: The technical evaluation phase took eight days. Doing the documentation took an additional four days.
Introduction, Continue with Business as Usual |
(Next) (Previous) (Table-of-Contents) |
This complete online business function is not being replaced. The current use of mainframe terminals by trained employees will continue. The "application extension" to allow customers to view and possibly update their information via the Internet will be a subset of the complete business function. The complete business function could be ported to the Internet or an Intranet but this should be a second phase or separate project.
Also, it should be noted that providing access to business functions by individuals outside a company may require a much higher level of usability than the current legacy systems provides. It should not be assumed that what can be accomplished within a company by a skilled employee can be easily mastered by a first time user that is not familiar with the application. Improved messages will be needed when an individual does not follow the business rules. Readily available help text will be a requirement when moving to the Internet.
Introduction, Rewrite using Java |
(Next) (Previous) (Table-of-Contents) |
The size and complexity of the examples in this project were small in comparison with the size and complexity of some of the legacy programs running critical business functions on the host system. Re-writing everything in Java for the Internet could not be done within the business time frame and cost objectives.
Introduction, Using both Java and COBOL |
(Next) (Previous) (Table-of-Contents) |
This option requires a teaming of both COBOL and Java programmers. An individual that is familiar with the techniques of providing documentation in a hypertext environment should be part of the team. Also, the software vendor that provides the API for the different languages should be included as part of the team. For this project the Micro Focus involvement was essential in order to meet the target date.
The COBOL Environment using Micro Focus Net Express |
(Next) (Previous) (Table-of-Contents) |
This application requires Net Express, version 3.1 with all the Web Sync fixes as of December 10, 2001.
Micro Focus Net Express® is a COBOL development environment for Windows and UNIX platforms offering an open scalable alternative to running COBOL systems on the mainframe. It combines a rich Windows development environment with tools for creating and extending enterprise business processes written in COBOL delivering distributed e-business COBOL applications on Windows or UNIX.
For more information refer to the Micro Focus web site at http://www.microfocus.com.
The Java Development and Run Time by Sun Micro System |
(Next) (Previous) (Table-of-Contents) |
This sample suite was initially tested using the Production Release of the JavaTM SDK, Standard Edition v 1.2.2_008 for Microsoft Windows.
In line with Sun Microsystems, Inc.'s continued support of developers targeting the JavaTM Platform on Microsoft Windows, Sun is committed to supporting both JDKTM 1.1.8 and the various Java 2 releases on Windows 2000. Sun is not aware of any significant issues with Sun Java releases on the Windows 2000, but it will provide normal support for any issues that should surface later. Now supported: Microsoft Windows 2000 Server, Windows 2000 Advanced Server and Microsoft Windows Millennium Edition (Windows Me) on these J2SETM platforms: JDKTM/JRE 1.1.8, J2SE v 1.2.2, and J2SE v 1.3.
This application uses the Java Developers Kit from Sun Micro Systems. For more information refer to their web site at http://www.sun.com.
The Lite Web Server by Gefion |
(Next) (Previous) (Table-of-Contents) |
This application uses the LiteWebServer from Gefion Software. LiteWebServer is a pure Java web server with native support for the Servlet 2.2 API and JavaServer Pages (JSP) 1.1. LiteWebServer's very small size (420 KB complete, 130 KB without JSP) makes it ideal for embedded systems, for bundling with web application demos sent to potential customers, and for running web applications distributed on CDs. It's also an easy to use web server for servlet development, personal use or a small intranet.
For more information refer to their web site at http://www.gefionsoftware.com.
Running the Application Examples |
(Next) (Previous) (Table-of-Contents) |
This section contains a description of "how to" use the applications provided within this demonstration package. A detailed specification for how each application is structured is provided in the Systems Information section of this document.
This suite of "Application Examples" contains a menu-of-applications page, six mini-applications and the documentation or help text.. To display the menu the local Web Server must be started (refer to the Starting the Lite Web Server section of this document.
To display the menu-of-applications page select the Net Express, "COBOL and Java Project" icon from the desktop.
Application Example, Customer Inquiry |
(Next) (Previous) (Table-of-Contents) |
To retrieve customer information simply type a six-digit customer number and press the Continue button.
The local Data Base contains twenty-six (26) records. The Customer numbers are six digits. Valid customer numbers are 00nn00 where nn is 01-26.
If a valid customer key is requested the name, address, city, state/province and postal code will be displayed. Otherwise, a message will be displayed.
Note: Refer to the System Information, Customer Inquiry, Structure and Design section for detailed specifications.
Application Example, Customer Registration |
(Next) (Previous) (Table-of-Contents) |
This section describes how to use the "Customer Registration" option to save information that has been typed by the user.
Note: Refer to the System Information, Customer Registration, Structure and Design section for detailed specifications.
Application Example, Write Me a Check |
(Next) (Previous) (Table-of-Contents) |
To display a check image simply type a name and an amount and press the Do a Check button. The numeric amount will be subjected to "reasonability" checks.
If the amount is "reasonable" a check image will be displayed with both a numeric and a converted text string showing the amount. Otherwise, a message will be displayed.
Note: Refer to the System Information, Write Me a Check, Structure and Design section for detailed specifications.
Application Example, Show Me the Date |
(Next) (Previous) (Table-of-Contents) |
This example will prompt a user for a date in the ccyymmdd format. The user types a date and clicks on the Vali-DATE button. The user date will then be processed by the date validation and editing routine.
If the user date is valid (i.e. meets the reasonability checks) the various date formats are displayed. Otherwise, an error message will be displayed.
The following is an example of the contents of the input or date-card.
DATECARD 1976/11/24
The following is an example of the date information provided by the date routine.
Gregorian Date .............. 19761124 Edited Gregorian Date ....... 1976-11-24 Text for the Date............ November 24, 1976 Julian Date ................. 1976329 Days remaining in the year .. 037 Leap Year Flag (Y or N) ..... Y Days in the Month ........... 30 Text for the Month .......... November
Note: Refer to the System Information, Show me the Date, Structure and Design section for detailed specifications.
Application Example, What is My Age |
(Next) (Previous) (Table-of-Contents) |
This example will prompt a user for a date of birth in the ccyymmdd format. The user types a date and clicks on the Calculate Age button. The number of days since the user's birth date and today's date will then be calculated and the results displayed.
If the user birth date is valid (i.e. meets the reasonability checks) the difference in days will be displayed. Otherwise, an error message will be displayed.
Note: Refer to the System Information, What is My Age, Structure and Design section for detailed specifications.
Application Example, Show Me the Hexadecimal Dump |
(Next) (Previous) (Table-of-Contents) |
This example will prompt a user for a text string. The user types a maximum of sixteen (16) characters and clicks on the Do HexDump button. The contents of the text string will be converted to a hexadecimal dump format and this will be displayed at the Server console and be written to the SYSLOG file.
Note: Refer to the System Information, Show Me the Hexadecimal Dump, Structure and Design section for detailed specifications.
System Information |
(Next) (Previous) (Table-of-Contents) |
The purpose of this section is to provide additional information for the Help Desk and programming support staff.
The Directory Structure |
(Next) (Previous) (Table-of-Contents) |
The following directory structure is based on the directory structure used by the Lite Web Server. This configuration was selected to simply the installation process and minimize the configuration and deployment efforts for the Lite Web Server.
|
|
Base directory for the Lite Web Server | ||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||
|
|
|
This is the batch file that sets the CLASSPATH environment variable and start the Lite Web Server | |||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||||||||
|
|
|
This ibatch file will set the CLASSPATH for the compiles of the COBOL and Java members. | |||||||||||||||||||||||||||||||||||
|
|
|
This is the Java Bean for Customer Inquiry. | |||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||
|
|
|
This is the KSDS VSAM Data Set. | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||
|
|
|
|
|||||||||||||||||||||||||||||||||||
|
|
|
This is the documentation and help text for the application. | |||||||||||||||||||||||||||||||||||
|
|
|
This is the Web page for the various options or functions provided by the demo. | |||||||||||||||||||||||||||||||||||
|
|
|
This is the Java Server Page for the customer inquiry and information display. | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
Setting Environment Variables |
(Next) (Previous) (Table-of-Contents) |
The following is the JAVA_HOME environment variable.
set JAVA_HOME=d:\j2sdk1.4.0
The following is a list of the entries for the PATH environment variable.
C:\WINNT\system32; C:\WINNT; C:\WINNT\System32\Wbem; d:\j2sdk1.4.0; d:\j2sdk1.4.0\bin; d:\lws-2.2.2\config\examples\classes;
For additional environment settings refer to the ZENVJLIB.BAT member in the Z-Members for System Tasks section of this document.
Z-Members for System Tasks |
(Next) (Previous) (Table-of-Contents) |
The Z-Members (Zxxxxxxx.BAT) are provided as a programatic method for setting environment varibales, mapping COBOL program file names to PC file names, compiling programs and starting the Lite Web Server. The Z-Members have an additional advantage of providing a documented and repeatable process.
ZENVJLIB.BAT, Setting Additional Environment Variables |
(Next) (Previous) (Table-of-Contents) |
The ZENVJLIB.BAT member is a batch file used to set the CLASSPATH and other environment variables. Notice it is also used to map PC file names to the COBOL program file names.
@echo off echo * %0 is STARTING... echo * %0 is STARTING... >XENVJLIB.LOG rem * rem * The following statement will cause the COBOL programs to rem * be compiled with ANIMATION enabled. rem * echo * JLIBMODE is set to %JLIBMODE% >>XENVJLIB.LOG SET JLIBANIM=ANIM echo * JLIBANIM is set to %JLIBANIM% >>XENVJLIB.LOG SET cobidy=d:\simojlib if "%JLIBMODE%" == "EXECUTE" SET cobidy=d:\simojlib echo * COBIDY is set to %COBIDY% >>XENVJLIB.LOG SET cobcpy=.;d:\simojlib echo * COBCPY is set to %COBCPY% >>XENVJLIB.LOG rem * set path=%path%;d:\Net Express;d:\Net Express\base\bin set ClassBASE=d:\lws-2.2.2 set CLASSPATH=. set CLASSPATH=%CLASSPATH%;c:\ set CLASSPATH=%CLASSPATH%;d:\j2sdk1.4.0 set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\lws.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\engine.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\util.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\servlet.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\jasper.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\jaxp.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\lib\parser.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\config\examples\classes set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar set CLASSPATH=%CLASSPATH%;%ClassBASE%\servlets set CLASSPATH=%CLASSPATH%;d:\Net Express\base\bin\MFCOBOL.JAR set CLASSPATH=%CLASSPATH%;d:\Net Express rem * rem * echo * path is %path% echo * classpath is %classpath% echo * echo * path is as follows... >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * %path% >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * classpath is as follows... >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * %classpath% >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * JAVA_HOME is %JAVA_HOME% >>XENVJLIB.LOG rem * rem * SET CUSTMAST=%ClassBASE%\datasys1\ebc00256.ksd echo * CUSTMAST is %CUSTMAST% echo * >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * CUSTMAST is as follows... >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * %CUSTMAST% >>XENVJLIB.LOG rem * SET syslog=%ClassBASE%\datasys1\syslog.txt if exist %syslog% goto :jump01 echo * SYSLOG creation . . . >%syslog% :jump01 echo * SYSLOG is %syslog% echo * >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * SYSLOG is as follows... >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * %SYSLOG% >>XENVJLIB.LOG rem * SET sysjrnl=%ClassBASE%\datasys1\sysjrnl.txt if exist %sysjrnl% goto :jump02 echo * SYSLOG creation . . . >%sysjrnl% :jump02 echo * SYSJRNL is %sysjrnl% echo * >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * SYSJRNL is as follows... >>XENVJLIB.LOG echo * >>XENVJLIB.LOG echo * %SYSJRNL% >>XENVJLIB.LOG rem * rem * echo * %0 is COMPLETE... echo * %0 is COMPLETE... >>XENVJLIB.LOG
ZCBLJLIB.BAT, Compiling and Linking the COBOL Programs |
(Next) (Previous) (Table-of-Contents) |
The following is the ZCBLJLIB.BAT that compiles and links the COBOL source members. The members will be compiled with NOANIM. To compile the programs with ANIMATE set the SIMOANIM environment variable as follows. The statement is found in the ZENVJLIB.BAT member.
set JLIBANIM=ANIM
Note: The preceding environment variable must be upper case.
@echo off rem **************************************************************** rem * This batch file compiles all the COBOL programs for the Demo. rem **************************************************************** rem * if exist XCBLJLIB.LOG erase XCBLJLIB.LOG echo * %0 for JLIBANIM is STARTING... >XCBLJLIB.LOG SET JLIBMODE=COMPILE CALL zenvjlib.bat rem * setlocal CALL :COMPILE AP01INQ1 CALL :COMPILE AP01INQ2 CALL :COMPILE AP02JRNL CALL :COMPILE AP05DIFF CALL :COMPILE SIMODATE CALL :COMPILE SIMOTXTN CALL :COMPILE SIMODUMP call :COMPILE SIMOLOGS echo * %0 for SimoJLIB is COMPLETE... >>XCBLJLIB.LOG dir XCBLJLIB.LOG type XCBLJLIB.LOG goto :END :COMPILE if exist %1.idy erase %1.idy if exist %1.obj erase %1.obj if exist %1.dll erase %1.dll if "%JLIBANIM%" == "ANIM" goto :COMPILE2 cbllink -D -Rm -o%1.DLL -Uzdirnoan.dir %1.CBL if exist %1.DLL echo * %1 compiled with NO ANIMATE... if exist %1.DLL echo * %1 compiled with NO ANIMATE... >>XCBLJLIB.LOG if exist %1.DLL goto :END echo * %1 Compile failure!!! >>XCBLJLIB.LOG :COMPILEEND :COMPILE2 cbllink -D -Rm -o%1.DLL -Uzdiranim.dir %1.CBL if exist %1.DLL echo * %1 compiled with ANIMATION... if exist %1.DLL echo * %1 compiled with ANIMATION... >>XCBLJLIB.LOG if exist %1.DLL goto :END echo * %1 Compile failure!!! >>XCBLJLIB.LOG :COMPILE2END :END
-d Create a .dll module.
-roption[v] Link your program with the shared run-time library using dynamic binding.
Note: Make sure the CLASSPATH is set correctly. Otherwise compile or link errors will occur.
The ZDIRNOAN.DIR file has one record that contains the following content.
noanim assign(external)
The ZDIRANIM.DIR file has one record that contains the following content.
anim csi assign(external)
ZJAVJLIB.BAT, Compiling the Java Programs |
(Next) (Previous) (Table-of-Contents) |
The following is the ZJAVJLIB.BAT that compiles the Java source members.
Note: Make sure the CLASSPATH is set correctly. Otherwise compile errors will occur.
@echo off rem **************************************************************** rem * This batch file compiles all the Java programs for the Demo. rem **************************************************************** echo * %0 for SimoJLIB is STARTING... >XJAVJLIB.LOG echo * %0 for SimoJLIB is STARTING, Please Wait... rem * SET JLIBMODE=COMPILE CALL zenvjlib.bat rem * setlocal call :COMPILE AP01JC01 call :COMPILE AP01JC02 call :COMPILE AP01JC03 call :COMPILE AP02JC01 call :COMPILE AP02JC02 call :COMPILE AP02JC03 call :COMPILE AP03JC01 call :COMPILE AP03JC02 call :COMPILE AP03JC03 call :COMPILE AP04JC01 call :COMPILE AP04JC02 call :COMPILE AP04JC03 call :COMPILE AP05JC01 call :COMPILE AP05JC02 call :COMPILE AP05JC03 call :COMPILE AP06JC01 call :COMPILE AP06JC02 call :COMPILE AP06JC03 echo * %0 for SimoJLIB is COMPLETE... >>XJAVJLIB.LOG dir XJAVJLIB.LOG type XJAVJLIB.LOG goto :END :COMPILE echo * XJAVJLIB - %1 is compiling if "%SIMOANIM%" == "DEBUG" goto :COMPILE2 if exist %1.class erase %1.class javac %1.java if exist %1.class echo * %1 compiled... >>XJAVJLIB.LOG if exist %1.class goto :END echo * %1 Compile failure!!! >>XJAVJLIB.LOG :COMPILEEND :COMPILE2 echo * %1.java is compiling... if exist %1.class erase %1.class javac %1.java if exist %1.class echo * %1 compiled... >>XJAVJLIB.LOG if exist %1.class goto :END echo * %1 Compile failure!!! >>XJAVJLIB.LOG :COMPILE2END :END
ZUPDJLIB.BAT, Starting the Lite Web Server Directory |
(Next) (Previous) (Table-of-Contents) |
After the programs have been compiled or changes have been made to the HTML or JSP pages in the SimoJLIB directory it will be necessary to update the LWS directories. The ZUPDJLIB.BAT member is provided as a process for updating the LWS directories.
@echo OFF rem * set BASELIB1=d:\lws-2.2.2\bin\ set DATALIB1=d:\lws-2.2.2\datasys1\ set HTMLLIB1=d:\lws-2.2.2\html\examples\ set PRODLIB1=d:\lws-2.2.2\config\examples\classes\ rem * echo * ZUPDJLIB.BAT, Copy the documentation and Main Menu Page. copy d:\simojlib\docsj001.htm %htmllib1% copy d:\simojlib\menuj001.htm %htmllib1% rem * echo * ZUPDJLIB.BAT, Copy the Java Server Pages, JSP's. copy d:\simojlib\ap01j001.jsp %htmllib1% copy d:\simojlib\ap02j001.jsp %htmllib1% copy d:\simojlib\ap03j001.jsp %htmllib1% copy d:\simojlib\ap04j001.jsp %htmllib1% copy d:\simojlib\ap05j001.jsp %htmllib1% copy d:\simojlib\ap06j001.jsp %htmllib1% rem * copy d:\simojlib\header01.gif %htmllib1% copy d:\simojlib\simotime.gif %htmllib1% copy d:\simojlib\mflogo01.gif %htmllib1% rem * echo * ZUPDJLIB.BAT, Copy the "Customer Inquiry" members. copy d:\simojlib\ap01jc01.class %prodlib1% copy d:\simojlib\ap01jc02.class %prodlib1% copy d:\simojlib\ap01jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the "Customer Registration" members. copy d:\simojlib\ap02jc01.class %prodlib1% copy d:\simojlib\ap02jc02.class %prodlib1% copy d:\simojlib\ap02jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the "Write me a Check" members. copy d:\simojlib\ap03jc01.class %prodlib1% copy d:\simojlib\ap03jc02.class %prodlib1% copy d:\simojlib\ap03jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the "Show me the Date" members. copy d:\simojlib\ap04jc01.class %prodlib1% copy d:\simojlib\ap04jc02.class %prodlib1% copy d:\simojlib\ap04jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the "What is my Age" members. copy d:\simojlib\ap05jc01.class %prodlib1% copy d:\simojlib\ap05jc02.class %prodlib1% copy d:\simojlib\ap05jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the "Show me the Hexadecimal" members. copy d:\simojlib\ap06jc01.class %prodlib1% copy d:\simojlib\ap06jc02.class %prodlib1% copy d:\simojlib\ap06jc03.class %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the COBOL members. copy d:\simojlib\ap01inq1.dll %prodlib1% copy d:\simojlib\ap01inq2.dll %prodlib1% copy d:\simojlib\ap02jrnl.dll %prodlib1% copy d:\simojlib\simodate.dll %prodlib1% copy d:\simojlib\simotxtn.dll %prodlib1% copy d:\simojlib\ap05diff.dll %prodlib1% copy d:\simojlib\simodump.dll %prodlib1% copy d:\simojlib\simologs.dll %prodlib1% rem * echo * ZUPDJLIB.BAT, Copy the EXEC members. copy d:\simojlib\zlwsjlib.bat %baselib1% copy d:\simojlib\zenvjlib.bat %baselib1% rem * echo * ZUPDJLIB.BAT, Copy the Data Files. copy d:\simojlib\datasys1\ebc00256.idx %datalib1% copy d:\simojlib\datasys1\ebc00256.ksd %datalib1%
ZLWSJLIB.BAT, Starting the Lite Web Server |
(Next) (Previous) (Table-of-Contents) |
The following batch file ZLWSJLIB.BAT is used to start the Lite Web Server.
@echo off echo * %0 is STARTING... echo * %0 is STARTING... >XLWSJLIB.LOG rem * SET JLIBMODE=EXECUTE call zenvjlib.bat echo * Path is %PATH% >>XLWSJLIB.LOG echo * ClassPath is %CLASSPATH% >>XLWSJLIB.LOG echo * JAVA_HOME is %JAVA_HOME% >>XLWSJLIB.LOG rem * echo * Path is %PATH% echo * ClassPath is %CLASSPATH% echo * JAVA_HOME is %JAVA_HOME% rem * java -DconfDir=%ClassBASE%\config com.gefionsoftware.server.lws.LiteWebServer rem * dir LWSJLIB.LOG >>XLWSJLIB.LOG echo * %0 is COMPLETE... >>XLWSJLIB.LOG
Starting the Application Menu |
(Next) (Previous) (Table-of-Contents) |
The Lite Web Server must be started before attempting to display the menu page. The following URL will start the application and display the menu (MENUJ001.HTM) page.
http://localhost:9090/examples/menuj001.htm
Application Structure and Design |
(Next) (Previous) (Table-of-Contents) |
When creating a user desktop environment that includes the mainframe as a shared component some of the key items to consider are as follows.
The following is an overview of the SimoTime "COBOL and Java" Application.
|
|
The Home Page or Menu of Option available for this project or application. | ||||||||||||||
|
|
An example of a data base inquiry program. | ||||||||||||||
|
||||||||||||||||
|
|
An example of how to capture information from a web page and write to a journal file. | ||||||||||||||
|
||||||||||||||||
|
|
Uses a COBOL program to create a text string from a numeric currency value provided. | ||||||||||||||
|
||||||||||||||||
|
|
Test a gregorian date for a valid format then create additional date formats. | ||||||||||||||
|
||||||||||||||||
|
|
Uses a COBOL program to calculate the difference between two dates. | ||||||||||||||
|
||||||||||||||||
|
|
Uses a COBOL program to do a Hex-Dump of a data item. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the documentation for this application (i.e. this document). | ||||||||||||||
|
||||||||||||||||
|
|
Provides access to the various adminitrative functions for the Lite Web Server. | ||||||||||||||
|
||||||||||||||||
|
|
Provides access to the various JSP Demonstrations provided by Gefion. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the Gefion Web Site. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the Micro Focus Web Site. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the COBOL Portal provided by Micro Focus. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the Sun Web Site. | ||||||||||||||
|
||||||||||||||||
|
|
A link to the SimoTime Web Site. |
Customer Inquiry, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "Customer Inquiry" option that does a simple inquiry into a data base using a customer number. The local Data Base contains twenty-six (26) records. The Customer numbers are six digits. Valid customer numbers are 00nn00 where nn is 01-26.
The Data Base is a VSAM, Keyed-Sequential-Data-Set (KSDS). The format is EBCDIC. The COBOL program (AP01CUST.CBL) does the translation between EBCDIC and ASCII prior to returning to the calling program.
When the user does a click-on the Help button a link is made via a separate window to the Customer Inquiry section of this document (DOCSJ001.HTM)
Note: Refer to the Running the Sample Applications, Customer Inquiry section to use the application.
The following is an overview of the Customer Inquiry function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that does conversion between ASCII and EBCDIC. | ||||||||||||||
|
|
||||||||||||||||
|
|
COBOL program that access the VSAM data set. | |||||||||||||||
|
|
||||||||||||||||
|
|
The VSAM Keyed Sequential Data Set that is EBCDIC format | |||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
Customer Registration, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "Customer Registration" option for saving information that has been typed by the user.
The Data Base is an ASCII/Text file. The format is ASCII. The COBOL program (AP02JRNL.CBL) does the writing to the file.
When the user does a click-on the Help button a link is made via a separate window to the Customer Registration section of this document (DOCSJ001.HTM)
Note: Refer to the Running the Sample Applications, Customer Registration section to use the application.
The following is an overview of the Customer Registration function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that writes to the journal file | ||||||||||||||
|
|
||||||||||||||||
|
|
The ASCII/Text file used to record information. | |||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
Write Me a Check, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "Write Me a Check" option that displays a check image. The AP03J001.JSP will promt the user for a name and an amount. The amount will be subjected to programmatic testing for reasonablility. If reasonable the cobol program (SIMOTXTN.CBL) will create a left-justified numeric, left-justifed amount string and a verbal text string to be used when producing the check image.
The COBOL program (SIMOTXTN.CBL) does the creation of a text string from the numeric currency value provided.
When the user does a click-on the Help button a link is made via a separate window to the "Write Me a Check" section of this document (DOCSJ001.HTM)
Note: Refer to the Running the Sample Applications, Write Me a Check section to use the application.
The following is an overview of the "Write me a Check" function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that creates a text string from a numeric value | ||||||||||||||
|
|||||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
Show Me the Date, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "Show Me the Date" function. This example will prompt a user for a date in the ccyymmdd format. The user types a date and clicks on the Vali-DATE button. The user date will then be processed by the date validation and editing routine. If the user date is valid (i.e. meets the reasonability checks) the various date formats are displayed. Otherwise, an error message will be displayed.
Note: Refer to the Running the Sample Applications, Show me the Date section to use the application.
The following is an overview of the "Show me the Date" function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that validates, creates and formats various date fields. | ||||||||||||||
|
|||||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
What is My Age, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "What is My Age" function. This function shows how to calculate the difference in days between two dates.
A COBOL program (AP05DIFF.CBL) does the calculation of the difference. This program also calls another COBOL program (SIMODATE.CBL) to convert the gregorian format to a julian format that is used in the difference calculation.
When the user does a click-on the Help button a link is made via a separate window to the "What is my Age" section of this document (DOCSJ001.HTM)
Note: Refer to the Running the Sample Applications, What is my Age section to use the application.
The following is an overview of the "What is my Age" function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that calculates the difference between birth date and today's date. | ||||||||||||||
|
|
||||||||||||||||
|
|
Edit Gregorian date and provide julian date. | |||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
Show Me the Hexadecimal Dump, Structure and Design |
(Next) (Previous) (Table-of-Contents) |
This section describes the infrastructure of the "Hexadecimal Dump" function. This function will prompt the user for a thirty-two (32) character string and then display the hex-dump translation of the text string at the server console. The hex-dump information will also be written to the SYSLOG file.
Note: Refer to the Running the Sample Applications, Show Me the Hexadecimal Dump section to use the application.
The following is an overview of the "Show Me the Hexadecimal Dump" function.
|
|
Java Server Page | |||||||||||||||
|
|
Java Bean | |||||||||||||||
|
|||||||||||||||||
|
|
Java scriplet that calls COBOL | |||||||||||||||
|
|
|
COBOL program that creates a displayable Hexadecimal Dump string. | ||||||||||||||
|
|
||||||||||||||||
|
|
Write to the SYSLOG file. | |||||||||||||||
|
|
||||||||||||||||
|
|
The SYSLOG File | |||||||||||||||
|
Java scriplet to format data to COBOL strings | ||||||||||||||||
Possibilities, Considerations & Limitations |
(Next) (Previous) (Table-of-Contents) |
When moving an application or part of an application from a legacy environment to an application server a number of challenges will need to be addressed. This section briefly identifies some of the challenges and possible resolutions.
ASCII and EBCDIC Translation |
(Next) (Previous) (Table-of-Contents) |
The "Customer Inquiry" function accesses a data base that is in EBCDIC format. This was done intentionally in order to determine how and when to do the ASCII and EBCDIC translation. It was decided to do the translation in the COBOL program since it could be easily accomplished with two tables and a single INSPECT statement.
Expanded Help Text |
(Next) (Previous) (Table-of-Contents( |
Providing access to business functions by individuals outside a company may require a much higher level of usability than many legacy systems provide. It should not be assumed that what can be accomplished within a company by a skilled employee can be easily mastered by a first time user that is not familiar with the application. A higher degree of "user-friendly-ness" may be required. Improved messages will be needed when an individual does not follow the business rules. Readily available help text will be a requirement when moving to the Internet.
Numeric Fields |
(Next) (Previous) (Table-of-Contents) |
Text fields are simply converted between EBCDIC and ASCII depending on the direction of information flow. Packed fields may be left unchanged or in some cases will need to be unpacked. Binary fields may need to be inversed or expanded. Floating point values are processed on an IBM mainframe using mainframe format. The PC uses the IEEE format for floating point values. Sorting results in different sequencing for EBCDIC and ASCII files containing the same information. Unique requirements of the programming language being used on the application server or client machines need to be considered. For example, some PC COBOL compilers allow for binary fields of various lengths. The mainframe works with binary lengths of 2, 4, 8 or 16 bytes.
Alpha-Numeric Fields, Truncate Trailing Spaces |
(Next) (Previous) (Table-of-Contents) |
Java has variable-length strings and COBOL has pre-defined, fixed-length fields. When returning information from COBOL back to Java it is more efficient to remove the trailing spaces. Also, if these trailing spaces are left in the Java string the user will not be able to easily make changes in insert-mode without first highlighting the spaces and them manually deleting the spaces. Java provides a method for easily removing the trailing spaces. The following is an example of the use of the trim() method.
public String getCustomerName() { return this.customerName.trim(); }
Summary |
(Next) (Previous) (Table-of-Contents) |
This paper is provided as a guideline for planning purposes. Performance is very dependent on the network traffic, the speed of the network and the availability of the mainframe.
The purpose of this document is to assist as a tutorial for new programmers or as a quick reference for experienced programmers. These sample programs are made available on an "as-is" basis and may be downloaded, copied and modified for specific situations as long as the copyright information is not removed or changed. As always, it is the programmer's responsibility to thoroughly test all programs.
Software Agreement and Disclaimer |
(Next) (Previous) (Table-of-Contents) |
Permission to use, copy, modify and distribute this software for any non-commercial purpose and without fee is hereby granted, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
Permission to use, copy, modify and distribute this software for any commercial purpose requires a fee to be paid to Simotime Enterprises. Once the fee is received by SimoTime the latest version of the software will be delivered and a license will be granted for use within an enterprise, provided the SimoTime copyright notice appear on all copies of the software. The SimoTime name or Logo may not be used in any advertising or publicity pertaining to the use of the software without the written permission of SimoTime Enterprises.
SimoTime Enterprises makes no warranty or representations about the suitability of the software for any purpose. It is provided "AS IS" without any express or implied warranty, including the implied warranties of merchantability, fitness for a particular purpose and non-infringement. SimoTime Enterprises shall not be liable for any direct, indirect, special or consequential damages resulting from the loss of use, data or projects, whether in an action of contract or tort, arising out of or in connection with the use or performance of this software.
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
Downloads and Links to Similar Pages |
(Next) (Previous) (Table-of-Contents) |
You may download this example at http://www.simotime.com/sim4dzip.htm#COBOLJavaDecemberProject as a Z-Pack. This Z-Pack is provided in zip format to reduce the amount of time to download. If the Z-Pack can be unzipped into a directory with the name of "D:\SimoJLIB" then the batch files provided for managing the members within the sample may run without modification.
Please view the complete list of SimoTime Z-Pack Examples at http://www.simotime.com/sim4dzip.htm.
Note: You must be attached to the Internet to download a Z-Pack or view the list.
The SimoZAPS Utility Program has the capability of generating a COBOL program that will do the conversion of sequential and VSAM (KSDS) files between EBCDIC and ASCII. SimoZAPS can also read a sequential file in EBCDIC format and create an ASCII/CRLF file or VSAM KSDS file in ASCII format. The conversion tables may be viewed or modified to meet unique requirements. The Hexcess/2 function provides the capability of viewing, finding or patching the contents of a file in hexadecimal.
Check out The COBOL Connection for more examples of mainframe COBOL coding techniques and sample code.
Check out The SimoTime Library for a wide range of topics for Programmers, Project Managers and Software Developers.
To review all the information available on this site start at The SimoTime Home Page .
Comments or Suggestions |
(Next) (Previous) (Table-of-Contents) |
If you have any questions, suggestions or comments please call or send an e-mail to: helpdesk@simotime.com
About SimoTime Enterprises |
(Next) (Previous) (Table-of-Contents) |
Founded in 1987, SimoTime Enterprises is a privately owned company. We specialize in the creation and deployment of business applications using new or existing technologies and services. We have a team of individuals that understand the broad range of technologies being used in today's environments. This includes the smallest thin client using the Internet and the very large mainframe systems. There is more to making the Internet work for your company's business than just having a nice looking WEB site. It is about combining the latest technologies and existing technologies with practical business experience. It's about the business of doing business and looking good in the process. Quite often, to reach larger markets or provide a higher level of service to existing customers it requires the newer Internet technologies to work in a complementary manner with existing corporate mainframe systems. Whether you want to use the Internet to expand into new market segments or as a delivery vehicle for existing business functions simply give us a call or check the web site at http://www.simotime.com
Return-to-Top |
Copyright © 1987-2012 SimoTime Enterprises All Rights Reserved |
When technology complements business |
http://www.simotime.com |