An example of how to create Java applications using TCPIP to send data wrapped in metadata to direct a server dialog with navigational (non SQL) DML on how to process the data and respond to the application.
search cancel

An example of how to create Java applications using TCPIP to send data wrapped in metadata to direct a server dialog with navigational (non SQL) DML on how to process the data and respond to the application.

book

Article ID: 53309

calendar_today

Updated On:

Products

IDMS IDMS - Database IDMS - ADS

Issue/Introduction

Description:

This document provides examples of Java classes with simple metadata such as ADD, MOD, DEL, GET, SGO etc to direct a server dialog to add, modify, delete different record types and also to sign on to the application by checking a user id and password with IDMS. It also demonstrates area and set sweeps and how to transfer member records of a set between owner records. The metadata code can be changed as long as the change is consistent between the client and the server to ensure that they understand each other.

Solution:

TCP/IP line definition with PTERM and LTERM for the SYSGEN:

  ADD LINE TCPIP   
   ENABLED   
   NOCOMPACT   
   PROTOCOL IS DEFRESP   
   TYPE IS SOCKET   
   MODULE IS RHDCD1IP.   
   
  ADD PTERM TCPLISTR   
   ENABLED   
   IN LINE TCPIP   
   MAXIMUM ERRORS IS 9   
   PRINTER CLASS IS 1   
   READBUFFER   
   TYPE IS LISTENER   
   TASK IS SRVRDLG MODE IS USER   
   PORT IS nnnnn   
   BACKLOG IS 5   
   IP STACK NAME IS stackname       
   MAXIMUM NUMBER OF CONNECTIONS IS OFF.  

In the PTERM definition IP STACK NAME IS stackname could be replaced with ADDRESS IS 'nnn.nnn.nn.nn' which represents the IP address.

  ADD LTERM TCPLISTR   
   ENABLED   
   PRIORITY IS 0   
   PTERM IS TCPLISTR. 

Task definition for SRVRDLG:

  ADD   
   TASK NAME IS SRVRDLG VERSION IS 1   
   PUBLIC ACCESS IS ALLOWED FOR ALL   
   WITHIN SYSTEM DCSYSTEM VERSION IS 1700   
   TASK PRIORITY IS 100   
   INACTIVE TASK INTERVAL IS OFF   
   EXTERNAL WAIT IS SYSTEM   
   DC OPTION IS ENABLED   
   DC OPTION IS EXTERNAL   
   DC OPTION IS INPUT   
   DC OPTION IS NOMAP   
   DC OPTION IS INVOKES PROGRAM ADSORUN1 VERSION IS 1. 

Tasks that invoke an ADS dialog must have the same name as the dialog. A dialog is a control block and is therefore not executable by itself. It is executed through ADSORUN1 and ADSOMAIN.

Please refer to the CA-IDMS System Generation Guide if more information is required.

Create the server dialog on IDMS:

The attachment contains a directory named Application that contains two subdirectories, ADS_source and JAVA_source. The ADS_source contains two members, IDMSDDDL which adds the records and the process for the dialog, and the ADSOBCOM member that compiles the dialog after the records and process are added. The JAVA_source contains the source for the Java classes. Execute the IDMSDDDL JCL to add the records and process for the dialog. This process uses a built-in function called EBCDIC-UTF8. Please refer to Knowledge Document TEC495321 on https://support.ca.com on how to implement this function. Also verify that EMPDEMO is the database name for your Employee Demo Database, if not correct the MOVE statement in the process SRVRDLG-EMPACCESS that updates DB-NAME with the name of this database. Special attention is required for record ADSCLI-WORK-RECORD. Element IPA-HOST in this record is a picture X(15) field that must have the VALUE clause updated with the IP address. Before running the IDMSDDDL JCL find the IPA-HOST element and change VALUE IS ( '999.999.999.999' ) to the IP address from which the server dialog will be running. In other words this must match the address defined on the LISTENER PTERM. After running the IDMSDDDL member, run the ADSOBCOM member to compile the dialog.

Once all this is done the server on your IDMS CV is ready. Next you will need to create the Java application client on your PC. This Knowledge Document assumes that Java is installed on your PC. The JAVA_source subdirectory contains these 26 Java source members:

   AddDept.java   
   AddEmployee.java   
   AddOffice.java   
   DeleteDept.java   
   DeleteEmployee.java   
   DeleteOffice.java   
   Dept_Panel.java   
   EmpDemoApp.java   
   EmpStatus.java   
   GlobalValues.java   
   KeyMonitor.java   
   ListDept.java   
   ListDeptOff.java   
   ListEmpAll.java   
   ListOffice.java   
   List_employees_for_dept.java   
   List_employees_for_office.java   
   ModifyDept.java   
   ModifyEmployee.java   
   ModifyOffice.java   
   Office_Panel.java   
   ShowDeptOffice.java   
   StrtEmpDemoApp.java   
   TCPIP_socket_connection.java   
   Transfer_Dept.java   
   Transfer_Office.java 

Create a directory on your PC and copy these 26 source members into it using Notepad. Java is case sensitive so maintain the case in the spelling of these names. For example assume the directory on the C drive is JAVA, create two subdirectories under JAVA, SRC and BIN. The source members could be copied into C:\JAVA\SRC>.

The IP address and port number from the listener PTERM must be updated in member GlobalValues.java.

You will see in GlobalValues.java

   public static String serveraddr = "YOUR.IPADDR.COM";       
   public static int serverPort = nnnn;  

Change YOUR.IPADDR.COM to be the same as the IP STACK NAME on the listener PTERM TCPLISTR

After updating GlobalValues.java with the correct IP address or stack name and port number, compile all members using this command while being current in the directory that contains the source members:

   C:\JAVA\SRC>javac -d C:\JAVA\BIN *   
   
   -d C:\JAVA\BIN   directs the compiler to load the classes into directory C:\JAVA\BIN.  

* directs the compiler to compile all members in the current directory. For this reason all the members in this directory must end with the.java extension.

Hit enter to compile the programs. The indication of a successful compile is simply being returned to the C:\JAVA\SRC> prompt without any messages. You could then get current on the C:\JAVA\BIN directory and use command DIR to verify that the java classes (Load modules) were created.

Directory of C:\java\bin

      01/11/2010 02:30 PM <DIR> .   
   01/11/2010 02:30 PM <DIR> ..   
   01/19/2010 11:43 AM          5,802 AddDept.class 
   01/19/2010 11:43 AM          12,009 AddEmployee.class 
   01/19/2010 11:43 AM          7,969 AddOffice.class 
   01/19/2010 11:43 AM          6,276 DeleteDept.class 
   01/19/2010 11:43 AM          9,605 DeleteEmployee.class 
   01/19/2010 11:43 AM          7,223 DeleteOffice.class 
   01/19/2010 11:43 AM          2,800 Dept_Panel.class 
   01/19/2010 11:43 AM          7,004 EmpDemoApp.class 
   01/19/2010 11:43 AM          1,188 EmpStatus.class 
   01/19/2010 11:43 AM          1,065 GlobalValues.class 
   01/19/2010 11:43 AM          570 KeyMonitor.class 
   01/19/2010 11:43 AM          7,205 ListDept.class 
   01/19/2010 11:43 AM          7,167 ListDeptOff.class 
   01/19/2010 11:43 AM          8,576 ListEmpAll.class 
   01/19/2010 11:43 AM          8,442 ListOffice.class 
   01/19/2010 11:43 AM          10,928 List_employees_for_dept.class 
   01/19/2010 11:43 AM          11,954 List_employees_for_office.class 
   01/19/2010 11:43 AM          6,900 ModifyDept.class 
   01/19/2010 11:43 AM          13,523 ModifyEmployee.class 
   01/19/2010 11:43 AM          8,842 ModifyOffice.class 
   01/19/2010 11:43 AM          3,045 Office_Panel.class 
   01/19/2010 11:43 AM          10,358 ShowDeptOffice.class 
   01/19/2010 11:43 AM          647 StrtEmpDemoApp.class 
   01/19/2010 11:43 AM          1,896 TCPIP_socket_connection.class 
   01/19/2010 11:43 AM          8,046 Transfer_Dept.class 
   01/19/2010 11:43 AM          8,606 Transfer_Office.class 
            26 File(s) 177,646 bytes 
                2 Dir(s) 54,454,927,360 bytes free 

To tell Java where to find the classes enter command

C:\JAVA\BIN> SET CLASSPATH=C:\JAVA\BIN and hit enter.

To execute the application use command

C:\JAVA\BIN>java StrtEmpDemoApp and hit enter.

A valid IDMS userid/password will be required to execute the application.

Environment

Release:
Component: ADS370

Attachments

1558535519629TEC507219.zip get_app