5 3 4 JSM from a 3GL program

Install LANSA on Linux

5.3.4 JSM from a 3GL program

This test matches the scenario where you will call JSM commands from your own program written on Linux in a 3rd Generation Language (3GL) such as C.

Before You Begin

Before you begin to test the JSM Server, check the following:

  • Have you installed the JSM Server on the Linux machine? (JSMDirect is not necessary.)
  • Have you installed the JSM Server licenses?
  • Do you know the IP address of the JSM Server on the Linux machine?
  • Do you have an appropriate 3GL compiler set up on the Linux machine?

Step 1. Start JSM

Use the strjsm script to start a JSM instance. Note that it will print the process ID of the new instance script.

If the JSM Server does not start, or stops after a few seconds, refer to Troubleshooting in the Installing LANSA on Windows Guide.

Step 2. Locate the JSM Shared Library

The JSM shared library, libx_jsm.so, contains the functions you will use to communicate with the JSM.  This file needs to be available when you compile and run your 3GL program. For C programs, x_jsm.h contains the API for these functions.

For more information about using the JSM shared library functions, refer to Java Service Manager Clients in the LANSA Integrator Guide.

Step 3. Compile and Run a 3GL Program

Some example programs written in C are provided in C examples in the LANSA Integrator Guide. A good starting point is Open/Close Examples in the LANSA Integrator Guide. This example tests that you have correctly started and configured the JSM. The example provides some debugging output to show whether the connection to the JSM was successful.

If you get an error message of the form "JSMMSG nnn", where nnn is a 3-digit number, you can look it up in C Client Error Messages in the LANSA Integrator Guide.

The example program allows you to enter an IP address or host name as a command line argument. When writing your own 3GL program, make sure that you use the IP address or host name of the Linux JSM Server in your JSMOPEN function call. Alternatively, since the function will run on the same machine as the JSM, you can use "LOCALHOST" to refer to the local machine. For example:

JSMOPEN ( "LOCALHOST:4560" , status , response ) ;