Code Generator Reference Pages
This section contains reference pages for the BEA WebLogic Java Adapter for Mainframe COBOL code generator (eGen COBOL). It describes the rules for writing the script file that controls the code generator.
eGen COBOL
The eGen COBOL tool maps a COBOL copybook into a Java class.
Synopsis
Invoke the tool with the following command:
java com.bea.jam.egen.EgenCobol scriptfile
where:
- java
- is the name of the Java virtual machine executable in the Java Development Kit (JDK).
- com.bea.jam.egen.EgenCobol
- is the full class name of the eGenCobol tool.
- scriptfile
- is the script file that controls the eGen COBOL tool. You must write this script file on an application-by-application basis. (See Listing A-1 for an example).
If the JAM installation bin directory has been added to your path, then the eGen COBOL tool may also be invoked with the command:
egencobol scriptfile
Listing A-1 Example of scriptfile.egen
### example script
#
view demo.CustomDataView from emprec.cpy
service demoService accepts CustomDataView returns CustomDataView
page demoPage "Demo Page"
{
view demo.CustomDataView
buttons
{
"Try It" service(demoService) shows demoPage
}
}
servlet demo.DemoServlet shows demoPage
Script Syntax Reserved Words
The reserved words shown in Table A-1 must be used as specified in the Grammar section.
Note: A reserved word can be used as an identifier if it is enclosed in either single or double quotation marks (refer to General Rules).
accepts
|
buttons
|
class
|
client
|
codepage
|
ejb
|
from
|
generate
|
group
|
is
|
method
|
page
|
reset
|
returns
|
server
|
service
|
servlet
|
shows
|
support
|
view
|
xml
|
|
|
|
General Rules
- The `#' character and all following characters on the same line are a comment. Use the `#' character to specify commented text.
- The character sequence "//" and all following characters on the same line are a comment. Use the "//" characters to specify commented text.
- The character sequence "/*" and all following characters until the occurrence of the sequence "*/" are a comment. Use the "/*" characters to specify commented text that extends beyond one line.
- White space (including newlines) is not significant. White space includes newlines, carriage returns, tabs, spaces, etc.
- Any sequence of letters, digits, underscores, or periods is a word.
- Any word that does not match a reserved word is an identifier.
- Any sequence of characters is treated as an identifier if it is enclosed in either single or double quotes. This allows the use of reserved words and sequences that contain spaces.
Grammar
The following grammar is described using a modified Backus-Naur Form (BNF) syntax, such as in many industry-standard software reference guides. It specifies a context-free grammar. Reserved words are shown in bold. Comments are in italics preceded by a dash (-).
- script:
- definition | script definition
- fulldefinition:
- generate definition | definition
- definition:
- viewdef | servicedef | servletdef | ejbdef | classdef | pagedef
- viewdef:
- view viewname from copybook | viewdf viewmodifier
- viewmodifier:
- codepage codepagename | support xml
- servicedef:
- service servicename accepts fullViewname returns fullViewname
- servletdef:
- servlet classname shows pagename
- ejbdef:
- clientejb | serverejb
- clientejb:
- client ejb classname ejbregistration { clientmethods }
- serverejb:
- server ejb classname ejbregistration { servermethods }
- classdef:
- client class classname { clientmethods }
- pagedef:
- page pagename title { view viewname buttons { buttonlist } }
- buttonlist:
- buttondef | buttonlist buttondef
- buttondef:
- servicebutton | ejbbutton
- clientmethods:
- clientmethoddef | clientmethods clientmethoddef
- clientmethoddef:
- method methodname is servicename
- servermethods:
servermehtoddef | servermethods servermethodddef
- servermethoddef:
method methodname (fullviewname) returns fullviewname
- servicebutton:
- buttonname service ( servicename ) shows pagename
- ejbbutton:
- buttonname ejbmethod ( fullViewname ) returns fullViewname
- viewname:
- classname
- fullViewname:
- viewname | viewname [ codepagename ]
- copybook:
- identifier
- -An identifier that names a file containing a COBOL data definition.
- servicename:
- identifier
- -An identifier that matches a resource definition in your jcrmgw.cfg file
- pagename:
- identifier
- -An identifier that names a page definition.
- codepagename:
- identifier
- -The name of a codepage to be used for character translation to/from mainframe data formats. This must be a codepage supported by the JDK being used.
- methodname:
- identifier
- -The name to be given to a generated Java method.
- classname:
- identifier
- -An identifier that names a Java class, including any package name.
- ejbregistration:
- identifier
- -The name that will be used to register the home interface for an EJB.
- title:
- identifier
- -The title to be placed into the HTML generated for a page.
- buttonname:
- identifier
- -A button name that will be used in the HTML generated for a page.
- ejbmethod:
- identifier
- -An EJB classname and method specification that should look like this:
- package.ejbclass.method
- or
- ejbclass.method
Results of Running the Code Generator
- Each view definition (described in the Programming Reference section of this guide) causes the specified COBOL copybook to be parsed and a Java source file for the specified DataView class to be generated in the current directory.
If XML support was requested, then the following files are also produced:
- viewnameHelper.Java - XML Helper class for use with WebLogic Process Integrator
- viewname.dtd - DTD file
- viewname.xsd - XML Schema file
- Each servlet definition causes a Java source file to be generated in the current directory for the specified class.
- Each client class definition causes a Java source file to be generated in the current directory for the specified class.
- Each EJB definition causes the generation of three Java source files and a deployment descriptor text file into the current directory. The names of the generated files are listed in Table A-2.
Name of File
|
Purpose
|
classnameHome.java
|
EJB Home Interface
|
classnameBean.java
|
EJB Implementation class
|
classname.java
|
EJB Remote Interface
|
classname-jar.xml
|
EJB Deployment descriptor
|
wl-classname-jar.xml
|
WebLogic Deployment Info
|
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
|