Analysis results

What results can you expect?

Objects

Cobol

Icon Description
Cobol Class
Cobol Conditional Test
Cobol Constant Data
Cobol CopyBook
Cobol Data
Cobol Data Link
Cobol Declarative Block
Cobol Declarative Paragraph
Cobol Declarative Section, Cobol Section
Cobol Directory/Root Directory
Cobol Division
Cobol Entry Point
Cobol File Link (Sequential, Partitioned, VSAM)
Cobol Index
Cobol Interface
Cobol Literal
Cobol Paragraph
Cobol Nested Program
Cobol Program
Cobol Structure Data
Cobol Transaction
Cobol SQL Query
Publisher IBM MQ
Subscriber IBM MQ
Cobol Call To Java Method

JCL

Icon Description
JCL Data Set (Sequential, Partitioned, VSAM)
JCL Directory/Root Directory
JCL External Procedure
JCL External Program
JCL Included File / Included Not Found
JCL Index
JCL In-stream Procedure
JCL to Java Program
JCL (Catalogued) Job
Unknown JCL Procedure
JCL (Catalogued) Job Prototype
JCL (Catalogued) Procedure
JCL Project
JCL Step
JCL SQL Query

IMS

Icon Description
IMS Alternate Program Control Block
IMS Database Program Control Block
IMS DB Definition
IMS DB Field
IMS Directory/Root Directory
IMS File / Transaction File
IMS GSAM Program Control Block
IMS Message Format Service
IMS Message Input Descriptor
IMS Message Output Descriptor
IMS Program Control Block
IMS Program Specification Block
IMS Project
IMS Segment / DB Segment
IMS Transaction
IMS SQL Query

CICS

Icon Description
CICS DataSet
CICS DB2 Transaction
CICS Definition File
CICS External File
CICS Folder
CICS Group
CICS Map
CICS MapSet
CICS Map Definition
CICS Project
CICS Temporary Storage
CICS Transaction
CICS Transient Data
CICS SOAP Operation
CICS SOAP Operation Call

Cobol

Link Type Linked Objects Code Example
Calling Called
CALL PROG* Program, section or copybook Program or entrypoint CALL "CC2DISPLAY"
TRANSAC* EXEC CICS XCTL
PROGRAM(TEST)
END EXEC
PERFORM Program, section or sub-object Section or paragraph MODULE-ENTREE SECTION.
*
* LA LIGNE CI DESSOUS DOIT ETRE DELETEE APRES LES TESTS
*
MOVE '* EXECUTION STARTEE NORMALEMENT *' TO MESS.
DISPLAY MESS.
MOVE SPACE TO MESS.
*
PERFORM LECTURE-PARAM.
*
FIN-MODULE-ENTREE. EXIT.
EJECT
*
COPY SYBPINIT.
GOTO Program First executed section or paragraph
LECTURE-PARAM SECTION.

*
READ MEF001.
IF FILE-STATUS NOT = '00'
DISPLAY 'CODE RETOUR' FILE-STATUS
DISPLAY 'CARTE PARAMETRE INEXISTANTE : ' CODE-ABEND
GO TO SORTIE-ERREUR
END-IF.
*
Section First executed paragraph in section
Paragraph Next executed paragraph in same section
- Section/Paragraph Section/Paragraph When Sections or Paragraphs are sequentially executed (one after the other) a Call link will be generated. For example, if a program is made of Section A then Section B then Paragraph C then Section D, the links will be resolved as A -> B -> C -> D.
INCLUDE Program or Copybook Copybook * -ACDA * MNPW * * * * * * * * * * * * * * * * * * * * * * * * *
* FD DU FICHIER INF103 PAR LE CHEMIN INF103
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
BLOCK CONTAINS 0.
*
COPY INF103 REPLACING INF103 BY ING103.
USE Calls to matched character strings Display "a string"
  • Cobol Program
  • Cobol Section
  • Cobol Paragraph
Program Specification Block EXEC DLI SCH PSB (MYPSB) END-EXEC
ACCESS OPEN
  • Cobol Program or sub-object
  • Cobol File Link
  • Cobol Data Link
*======================================================== * OUVERTURE DU FICHIER IAHCDECE *======================================================== OPEN-IAHCDECE.
OPEN INPUT IAHCDECE. *======================================================== * LECTURES DU FICHIER IAHCDECE *======================================================== LECT-IAHCDECE.
READ IAHCDECE
. *======================================================== * FERMETURE DU FICHIER IAHCDECE *======================================================== CLOSE-IAHCDECE.
CLOSE IAHCDECE.
 

*======================================================== * LECTURE-SEGMENT-CISRAPMP *========================================================
EXEC DLI
GU
USING
PCB (3)
SEGMENT (CISRAPMP)
WHERE (CIOEAX = IN-PREM-H)
INTO (WS-DUMMY-AREA)
END-EXEC.
 

*========================================================
COMMANDE-CALL-LEVEL
*========================================================
CALL 'CBLTDLI' USING GU
CICSDLI-PCB
CICSDLI-SEGM
CICSDLI-QSSA

CLOSE
READ
  • Cobol Program or sub-object
  • Cobol Section
  • Cobol Paragraph
  • Cobol File Link
  • Cobol Data Link
  • Constant Data
  • Structured Data
  • Data
  • Conditional Test
  • Program Communication Block
    (IMS PCB)
  • IMS Segment
WRITE

For Embedded SQL links, the following are valid for all servers.

Link Sub-link Description Example
USE SELECT This type is reserved for server side object referencing EXEC SQL... SELECT
USE UPDATE As above. EXEC SQL... UPDATE
USE INSERT As above. EXEC SQL... INSERT
USE DELETE As above. EXEC SQL... DELETE
CALL - - EXEC SQL... CAL

For link types CALL PROG and CALL TRANSAC, two limitations exist when the call is in “string” form:

  • If the string is constant and declared in the “data-division” section, the entry point will be resolved in the normal way.
  • If the string is dynamic, the program may be found by the Dynamic Link Manager.

In addition, the following Embedded SQL links are valid for DB2 only:

Link Sub-link Description Example
DEPEND ON - This type is reserved for server side object referencing on structured or distinct UDTs. -
DDL CREATE This type is reserved for server side object referencing on Tables -
DDL DROP - -

JCL

Links Sub-link Calling object Called object
ACCESS WRITE, READ, EXECUTE JCL Step JCL Data Set
PROTOTYPE - Cobol File Link JCL Data Set
Cobol Data Link JCL Data Set
JCL Data Set Cobol JCL Program
CALL - JCL Step Cobol JCL Program
JCL Job JCL Step
JCL Procedure JCL Step
JCL Step JCL Procedure
USE - JCL Step IMS DBD
MONITOR AFTER JCL Step JCL Step

IMS

Links Sub-link Calling object Called object
ACCESS WRITE IMS PC Block IMS Segment
USE - IMS PC Block IMS DBD or IMS GSAM File

CICS

Links Sub-link Calling object Called object
CALL TRANSAC CICS Transid Client/Cobol Program

For Transactional Code, the following are valid:

Link Sub-link Calling object Called objects When does this link occur?
CALL TRANSAC Client/Cobol Program or its Sub object Client/Cobol Program EXEC CICS XCTL
PROGRAM(TEST)
END EXEC

or

EXEC CICS LINK
PROGRAM(TEST)
END EXEC
CALL TRANSAC Client/Cobol Program or its Sub object CICS Transaction EXEC CICS START
TRANSID(TRANSID)
END EXEC

or

EXEC CICS RETURN
TRANSID (W-XFR-CTRS)
COMMAREA (W-CIC-CMA-LDON)
LENGTH (W-CIC-CMA-QLENDON)
END-EXEC
MONITOR - Client/Cobol Program or its Sub object CICS Map EXEC CICS
SEND MAP (W-CIC-CMAPCUR)
MAPSET (W-CIC-CMPSCUR)
FROM (MGAB10O)
ERASE
FREEKB
FRSET
CURSOR
END-EXEC

or

EXEC CICS
RECEIVE MAP (W-CIC-CMAPCUR)
MAPSET (W-CIC-CMPSCUR)
FROM (MGAB10O)
END-EXEC
ACCESS OPEN, CLOSE, READ, WRITE Client/Cobol Program or its Sub object CICS Dataset ENDBR, DELETE,
LINK, READ, READNEXT,
READPREV, REWRITE,
STARTBR, XCTL,
WRITE

e.g.:

EXEC CICS
READ DATASET ('C1MASTR')
INTO (BLKBLK(BLKBLK-OCUR))
RIDFLD (CICS-RRN) RRN
RESP (WS-RESP) END-EXEC
ACCESS READ, WRITE Client/Cobol Program or its Sub object CICS Transient Data DELETEQ, READQ, WRITEQ

e.g.:

EXEC CICS DELETEQ TD QUEUE (W-CIC-TSQ-LNOM)

Miscellaneous Cobol information

Rules for resolving Paragraph names in a Section

The Mainframe Analyzer (Cobol) uses the following rules when resolving Paragraph names defined in Sections:

  1. If the referenced Paragraph is located in the current Section, Cobol Analyzer will link the calling Paragraph to the called Paragraph
  2. If the referenced Paragraph is not located in the current section, Cobol Analyzer will issue a syntax error
  3. If the referenced Paragraph has a unique declaration outside the Section, Cobol Analyzer will create a link to this Paragraph.
  4. The following syntax is also resolved: “Paragraph Name IN/OF Section Name”. A link will be created to the correct Paragraph (which will be outside the current Section).

Access type links

Access type links are created when your Cobol program calls an external file (Data Set).

  1. The instructions that manage classic files (‘File Link’ type) are:

    Instructions for opening a file: OPEN Reading data: READ Writing data: WRITE, REWRITE Closing the file: CLOSE

  2. Sorting operations on data set files (Data Link type) are carried out via the instructions MERGE and/or SORT. These instructions should generate CALL + PERFORM type links on paragraphs or sections. OPEN and CLOSE instructions are also used.

  3. Access (Read/Write) links to “Cobol Constants” and “Cobol Data”:

    • Variables used in the flow control: IF, PERFORM, EVALUATE, SEARCH.
    • Inclusion of the instructions: MOVE, INITIALIZE, SET, CALL, OPEN, CLOSE, READ, WRITE, REWRITE, MERGE, SORT.
    • The following instructions are not yet included: MULTIPLY, SUBTRACT, ADD, DIVIDE, EXHIBIT.
  4. CICS files read via CICS instructions in an EXEC CICS … END-EXEC

    • Opening of file - Instructions: STARTBR – Acesse(Open) on the file
    • Data reading - Instructions: DELETE, WRITE, REWRITE – Access(Write)
    • Closing of file - Instruction: ENDBR – Access(Close)
  5. Access to the segment in the IMS databases:

    • Links to the segment (Access + Write/Read)
    • Links to the Program Specification Block

File Selection

Logical Files are declared in the “File Section” part of the program with the FD or SD tag.

  • FD: declaration of  ‘file link’ type
  • SD: declaration of ‘data link’ type

Example declaration of a logical file called MAIL-XREF (type FILE-LINK) in the Cobol program:

004600 FILE SECTION.                          00015900
004700                                          00016000
009000 FD MAIL-XREF                             00020700
009100 LABEL RECORDS ARE STANDARD               00020800
009200 BLOCK CONTAINS 0 RECORDS.                00020900
009300 01 MAIL-XREF-REC.                        00021000
009400 03 MAIL-XREF-KEY.                        00021100
009500 07 MAIL-XREF-ADDRESS.                    00021200
009600 11 MAIL-XREF-ZIP-PRE PIC X(05).          00021300
009700 11 MAIL-XREF-ZIP-SUF PIC X(04).          00021400
009800 07 MAIL-XREF-STATE PIC X(03).            00021500
009900 07 MAIL-XREF-CITY PIC X(25).             00021600
010000 07 MAIL-XREF-POSTAL-CODE PIC X(02).      00021700
010100 03 MAIL-XREF-DATA PIC X(324).            00021800

Replacement used in COPY REPLACING directives

  • Replacements can be applied to words or parts of words
  • Patterns used to replace parts of words must be delimited by the following characters:  :, (, ), \ or "
  • Patterns that are not delimited by the above characters are considered as being used to replace entire words
  • LEADING and TRAILING clauses mean that the replacement will be applied on parts of words and as such, patterns must respect rule two (first character and last character will be removed from the pattern).

Miscellaneous JCL Information

JCL is a command language used to execute programs on large systems - primarily Cobol oriented. CAST’s Mainframe Analyzer (JCL) is targeted at IBM’s JCL language for 3090 systems used in conjunction with Cobol projects.

Specific information about rule results

Avoid using ALTER (5062)

The rule Avoid using ALTER (5062)external link is designed to trigger a violation when an ALTER statement is used in a COBOL program. However, when a COBOL copybook is referenced in a COBOL program and the copybook itself contains an ALTER statement, CAST will create a violation on the COBOL program, even though the COBOL program itself does not contain the ALTER statement.

This behaviour may create violations where you were not expecting them.

Display in CAST Enlighten

In CAST Enlighten, a full Mainframe Analysis (i.e. including COBOL, JCL, CICS and IMS) may be represented as follows:

COBOL Objects branch - if the data has NOT been saved in the Analysis Service (Data Structures > Save Data Only option in the Mainframe Technology options is not activated). Note that the Cobol Copybooks and its sub-heading Data in the Source file folders heading will only be visible if the Save data found in copy books option in the Mainframe Technology options is activated:

COBOL Objects branch - if the data has been saved in the Analysis Service (Data Structures > Save Data Only option in the Mainframe Technology options is activated). Note that the Cobol Copybooks and its sub-heading Data in the Source file folders heading will only be visible if the Save data found in copy books option in the Mainframe Technology options is activated:

JCL Objects branch

CICS Objects branch

IMS Objects branch

Changes introduced in Mainframe Analyzer 1.1

New object “Cobol SQL Query”

For each embedded SQL statement found in Cobol (except INCLUDE statements which are already supported by creating a Copy Book object), an object called Cobol SQL Query is created. For example, the following code will cause this object type to be created:

EXEC SQL
    SELECT ABCDED
    FROM TABLE
END-EXEC

A ReferLink will now be added between sections/paragraphs containing the CICS command HANDLE ABEND LABEL and the sections/paragraphs specified in the LABEL clause. For example:

In the same way, a ReferLink is added for the CICS commands HANDLE AID and HANDLE CONDITION:

Supported conditions

Below is a list of the conditions supported by the Mainframe Analyzer ≥ 1.1:

CICS command Condition
HANDLE ABEND LABEL
HANDLE AID ANYKEY
CLEAR
CLRPARTN
ENTER
LIGHTPEN
OPERID
PA1, PA2, PA3
PF1 - PF24
TRIGGER
HANDLE CONDITION ALLOCERR
CBIDERR
CHANNELERR
DISABLED
DSIDERR
DSSTAT
DUPKEY
DUPREC
END
ENDDATA
ENDFILE
ENDINPT
ENQBUSY
ENVDEFERR
EOC
EODS
EOF
ERROR
EXPIRED
FUNCERR
IGREQCD
IGREQID
ILLOGIC
INBFMH
INVERRTERM
INVEXITREQ
INVLDC
INVMPSZ
INVPARTN
INVPARTNSET
INVREQ
IOERR
ISCINVREQ
ITEMERR
JIDERR
LENGERR
LOADING
LOCKED
MAPFAIL
NETNAMEIDERR
NODEIDERR
NOJBUFSP
NONVAL
NOPASSBKRD
NOPASSBKWR
NOSPACE
NOSPOOL
NOSTART
NOSTG
NOTALLOC
NOTAUTH
NOTFND
NOTOPEN
OPENERR
OVERFLOW
PARTNERIDERR
PARTNFAIL
PGMIDERR
QBUSY
QIDERR
QZERO
RDATT
RECORDBUSY
RESUNAVAIL
RETPAGE
ROLLEDBACK
RTEFAIL
RTESOME
SELNERR
SESSBUSY
SESSIONERR
SIGNAL
SPOLBUSY
SPOLERR
STRELERR
SUPPRESSED
SYSBUSY
SYSIDERR
TERMERR
TASKIDERR
TERMIDERR
TRANSIDERR
TSIOERR
UNEXPIN
USERIDERR
WRBRK

Changes introduced in Mainframe Analyzer 1.2

Support for CICS Webservices

Introduction

Web services make the interactions between programs over a network. There are two types of CICS Webservice:

  • Provider: CICS acting as server to provide information
  • Requester: CICS acting as client to request information

For example:

The items highlighted with a green oval represent the new objects and the new links to existing Mainframe type objects. Where:

  • Cob program ECHOCLNT: client program to invoke the cob program which handles the CICS Webservice  
  • Cob program ECHOPROG: the cob program which handles the CICS Webservice as a Provider
  • Cob program ECHOWEBS: the cob program which handles the CICS Webservice as a Requester
  • CICS Webservice and Call to CICS Webservice: new objects which represents CICS webservice support 
  • JCL Step LS2WS: JCL step which run a Webservice utility batch to create a web service provider in CICS
  • JCL Step WS2LS: JCL step which run a Webservice utility batch to create a web service requester in CICS

CICS SOAP Operation/CICS SOAP Operation Call

We use the SOAP protocol for these objects.

Linking by port_type.operation_name

Each wsdl is a webservice resource file corresponding to a CICS SOAP Operation or CICS SOAP Operation Call which must consist the URI, PortType and Operation:

<portType name="ECHOPROGPort">
      <operation name="ECHOPROGOperation">
         <input message="tns:ECHOPROGOperationRequest" name="ECHOPROGOperationRequest"/>
         <output message="tns:ECHOPROGOperationResponse" name="ECHOPROGOperationResponse"/>
      </operation>
</portType>
<service name="ECHOPROGService">
      <port binding="tns:ECHOPROGHTTPSoapBinding" name="ECHOPROGPort">
         <!--This soap:address indicates the location of the Web service over HTTP.
              Please replace "my-server" with the TCPIP host name of your CICS region.
              Please replace "my-port" with the port number of your CICS TCPIPSERVICE.-->
         <soap:address location="http://my-server:my-port/ca1p/echoProgProviderBatch"/>
         <!--This soap:address indicates the location of the Web service over HTTPS.-->
         <!--<soap:address location="https://my-server:my-port/ca1p/echoProgProviderBatch"/>-->
         <!--This soap:address indicates the location of the Web service over WebSphere MQSeries.
              Please replace "my-queue" with the appropriate queue name.-->
         <!--<soap:address location="jms:/queue?destination=my-queue&connectionFactory=()&targetService=/ca1p/echoProgProviderBatch&initialContextFactory=com.ibm.mq.jms.Nojndi" />-->
      </port>
 </service>

Configuration

In order for CAST to be able to fully support CICS Webservices, the extension *.wsdl must be manually added to the CICS File Extensions option in the configuration of Mainframe extension in CAST Console:

Note: this file extension .wsdl will be added to the CICS File Extensions option by default in a future release of AIP Core.

Example Provider Webservice

SAMPLE1.jcl job has the LS2WS step which run the DFHLS2WS webservice utility and exposed ECHOPROG cob program as a Webservice Provider:

//LS2WS   EXEC DFHLS2WS,                                                        
//    JAVADIR='java142s/J1.4',                                                  
//    USSDIR='cics650',                                                         
//    PATHPREF='',                                                              
//    TMPDIR='/tmp',                                                            
//    TMPFILE='ls2ws'                                                           
//INPUT.SYSUT1 DD *                                                             
LOGFILE=<Install_Directory>/ca1p/wsbind/provider/*                              
echoProgProviderBatch.log                                                       
PDSLIB=//<INSTALL_HLQ>.CA1P.COBCOPY                                             
REQMEM=ECHOCOMM                                                                 
RESPMEM=ECHOCOMM                                                                
LANG=COBOL                                                                      
PGMNAME=ECHOPROG                                                                
URI=ca1p/echoProgProviderBatch                                                  
PGMINT=COMMAREA                                                                 
WSBIND=<Install_Directory>/ca1p/wsbind/provider/*                               
echoProgProviderBatch.wsbind                                                    
WSDL=<Install_Directory>/ca1p/wsdl/echoProgProviderBatch.wsdl                   
MAPPING-LEVEL=1.2    

The parameter PGMNAME specifies the name of the cob program that will be exposed as a web service => ECHOPROG.cob

The parameter WSDL specifies the location of the web service description file => echoProgProviderBatch.wsdl

Example Requester Webservice

SAMPLE2.jcl job has the WS2LS step which run the DFHWS2LS webservice utility and exposed ECHOWEBS cob program as a Webservice Requester:

//WS2LS   EXEC DFHWS2LS,                                                        
//    JAVADIR='java142s/J1.4',                                                  
//    USSDIR='cics650',                                                         
//    PATHPREF='',                                                              
//    TMPDIR='/tmp',                                                            
//    TMPFILE='WS2LS'                                                           
//INPUT.SYSUT1 DD *                                                             
LOGFILE=<Install_Directory>/ca1p/wsbind/requester/*                             
echoProgRequesterBatch.log                                                      
PDSLIB=//<INSTALL_HLQ>.CA1P.COBCOPY                                             
REQMEM=ECHOPI                                                                   
RESPMEM=ECHOPO                                                                  
LANG=COBOL                                                                      
WSBIND=<Install_Directory>/ca1p/wsbind/requester/*                              
echoProgRequesterBatch.wsbind                                                   
WSDL=<Install_Directory>/ca1p/wsdl/echoProgRequesterBatch.wsdl                  
MAPPING-LEVEL=1.2  

ECHOWEBS.cob must consist a CICS invoke webservice command linking to the same webservice resource echoProgRequesterBatch (echoProgRequesterBatch.wsdl):

MOVE 'echoProgRequesterBatch'                                        
             TO WS-WEBSERVICE-NAME 
EXEC CICS INVOKE WEBSERVICE(WS-WEBSERVICE-NAME)                      
             CHANNEL(WS-CHANNEL-NAME)                                           
             OPERATION(WS-OPERATION-NAME)                                       
             RESP(COMMAND-RESP) RESP2(COMMAND-RESP2)                            
END-EXEC                                                 

Cobol File Link objects will link to DDS Display File /DDS Printer File/ DDS Physical File / DDS Logical File of RPG which has the same object name:

Support EXEC CICS LOAD PROGRAM

A useLink link will added from Cobol Section objects to Cobol Program objects when the EXEC CICS LOAD PROGRAM statement is used:

EXEC CICS LOAD PROGRAM ('ME00000B')

Support EXEC CICS HANDLE ABEND PROGRAM

A referLink will be added from Cobol Section objects to Cobol Program objects when the EXEC CICS HAND ABEND PROGRAM statement is used:

EXEC CICS HANDLE ABEND PROGRAM ('ME00000A')

Support INDEX BY

A new object type Cobol Index is created with a RelyON Link to cobol data using INDEX BY statement, other links are created to the new Cobol Index Object when it is referenced:

15 T-BUCH-VAR          OCCURS 1000  ASCENDING KEY
                                  T-BUCH-ST-2-20
                       INDEXED BY I-BUCH.

...

D0200.
           SET I-BUCH TO 1.
      
D0202.
           MOVE T-BUCH-VAR (I-BUCH) TO V-BUCH.

Support PROCESSING PROCEDURE

Link between paragraphs is created when they are referenced in PROCESSING PROCEDURE statement:

 1300-XML-PARSE.                                          
             XML PARSE WS-INT-XML-RESPONSE                                      
                       ( 1 : WS-INT-XML-RESPONSE-LEN )                          
                 PROCESSING PROCEDURE                                           
                   1350-XMLEVENT-HANDLER THRU 1350-EXIT 
             END-XML                                            

Changes introduced in Mainframe Analyzer 1.3

New object “IMS SQL Query”

For each embedded IMS SQL statement found in Cobol, an object called IMS SQL Query is created. For example, the following code will cause this object type to be created:

ENTERING-THE-PROGRAM.                                            
EXEC SQLIMS                                                  
FETCH cursor-name INTO :HOSPITAL-RESULT-ROW               
END-EXEC

Changes introduced in Mainframe Analyzer 1.4

Changes introduced in Mainframe Analyzer 1.5.0-beta1

Support CICS Mirror Transactions

A callTransacLink is created when a Cobol program is associated with a Transaction in CSD file. For example, the following code indicates that Cobol program Y774UPRI is associated with TRANSID(Y774).

DEFINE PROGRAM(Y774UPRI) GROUP(N476P1)                                         
DESCRIPTION(CSCF - UPS PREMIER INITIATION MODULE)                              
       LANGUAGE(COBOL) RELOAD(NO) RESIDENT(NO) USAGE(NORMAL)                   
       USELPACOPY(NO) STATUS(ENABLED) CEDF(YES) DATALOCATION(ANY)              
       EXECKEY(USER) CONCURRENCY(THREADSAFE) API(CICSAPI) DYNAMIC(NO)          
       REMOTESYSTEM(CS28) REMOTENAME(Y774UPRI) TRANSID(Y774) 

Changes introduced in Mainframe Analyzer 1.5.0-beta5

Support Cobol Call To Java Method in IBM i (AS/400)

New support of COBOL program calls Java methods in IBM i (AS/400) platform using invocation API functions Java Native Interface (JNI).

An example Cobol program calls to Java Methods: Example of COBOL Calling Javaexternal link

First of all, Java VM is created and initialized, the API references transfer to JDKINIT and JNI members.

JNI interface function FIND-CLASS:

CALL FIND-CLASS USING BY VALUE ENV-PTR
                               CLASS-NAME-PTR
                RETURNING INTO MY-CLASS-REF.

This function returns a class reference MY-CLASS-REF for CLASS-NAME-PTR (HelloWorldCbl java class in this example). The value of CLASSPATH (JDKINIT member) which is the actual directory containing the class file must be resolved.

MY-CLASS-REF can be used to invoke the methods of this class.

JNI interface functions supported to invoke Java methods:

  • GET-METHOD-ID

  • GET-STATIC-METHOD-ID

  • NEW-OBJECT

CALL GET-METHOD-ID USING BY VALUE ENV-PTR
                         MY-CLASS-REF
                         METHOD-NAME-PTR
                         SIGNATURE-NAME-PTR
                   RETURNING INTO METHOD-ID.

The Java method METHOD-NAME-PTR in the Java class MY-CLASS-REF is called. An object Cobol Call To Java Method is created and it will link to the corresponding Java Method.

Configuration for IBM i (AS/400)

Because some predefined names provided by IBM have more than 8 characters such as CLASSPATH data, JDK11INIT copybook . The option IBM z/OS (using only 8 characters) must be deactivated.