BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
JAM Documentation | JAM Reference Guide | Previous Topic | Next Topic | Contents | Index

eGen COBOL Code Generator Reference

This section contains reference pages for the BEA WebLogic Java Adapter for Mainframe eGen COBOL Code Generator (eGen utility). This information includes the rules for writing the script file that controls the code generator.

eGen COBOL

The eGen utility maps a COBOL copybook into a Java class.

Synopsis

Invoke the utility 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 eGen utility.

  scriptfile

  is the script file that controls the eGen utility. You must write this script file on an application-by-application basis. (See Listing 2-1 for an example).

If the JAM installation bin directory has been added to your path, then the eGen utility may also be invoked with the command:

egencobol scriptfile

Listing 2-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 2-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).

Table 2-1 Reserved Words

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, except when it is used to seperate tokens. 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 eGen COBOL script grammar uses a modified Backus-Naur Form (BNF) syntax, which is used in many industry-standard software reference guides. BNF syntax 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 eGen COBOL Code Generator

The specified COBOL copybook is parsed for each DataView definition (described in the JAM Programming Reference section of this guide) and a Java source file for the specified DataView class is generated in the current directory.

If XML support was requested, then the following files are also produced:

viewname.dtd - DTD file

viewname.xsd - XML Schema file

For each client class definition, a Java source file is generated in the current directory for the specified class.

For each EJB definition, three Java source files and a deployment descriptor text file are generated in the current directory. The names of the generated files are listed in Table 2-2.

Table 2-2 Generated Files for EJB Definitions

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 © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.