jRCS Server Installation


jRCS uses XML over TCP/IP to communicate with the host, so the client library is not really necessary. However, recognizing the fact that XML is not straight and easy to interpret in all programming languages, it was decided to create a client library written in C++ to simplify this task. The Windows-based ActiveX client we supply is installed in the $JBCRELEASEDIR\JRCSCLIENT folder or in C:\Program Files\JRCSCLIENT if $JBCRELEASEDIR is unavailable on the client computer. Please note that the jRCS client does not require the installation of any jBASE libraries on the client computer.

The C++ dynamic-link library, along with the export library is installed in subfolder lib of the client installation folder. The include folder contains the header files required to compile the client programs, and the OS folder contains OS-specific dependencies of the include files. In order to compile a program using jRCS client, the environment in Microsoft Visual C++ must include the path to the client‟s include folder for pre-processor and lib folder for linker dependencies. The client must also specify jrcs.lib in the list of libraries the program links with. The installation automatically adds jrcs.dll to the system path, so the dynamic loader can find the library on program start-up.

 

ActiveX Layer

On Windows systems, jRCS adds another layer enabling interoperability with ActiveX containers, such as Visual Basic. The installer writes the library jrcax.dll into the lib folder, along with jRCS.dll. The library is registered on the system as an ActiveX DLL and is accessible from Visual Basic via a list of references. The ActiveX library exposes a full set of jRCS functions to the client, along with error constants and I/O handler interface.

Sample Program using jRCS for ActiveX

In order to test how jRCS can be called from Visual Basic, you need to perform the following steps:

  1. Install jRCS server on the machine you designate as your host. Set up the client on your development machine (the host and development machines can be the same computer)
  2. Ensure that jRCS service is started on the host
  3. Create a user account called TEST on the host and note where you point the home directory of that user
  4. Log on as user TEST on the host, set up jBASE environment and run jSH in the home directory
  5. Create a blank J4 file called TEST. Pick the modulo at your discretion
  6. Create a file called JRCSRC.CMD and set the jBASE environment variables in that file, including JBCRELEASEDIR, JBCGLOBALDIR, PATH, JEDI_FILEPATH, etc. See section 4.1.3 for more information on how to work with jRCS profiles
  7. Note the name or IP address of the host machine
  8. Start Visual Basic on the development machine and create a blank EXE project. Open Form1 created by VB and add a button called Command1 to the form
  9. From the Project menu select References and in the reference dialog check "jBASE Remote Connectivity Library". Close the reference dialog
  10. Double-click the Command1 button and in Command1_Click type (or paste) the following code:

Private Sub Command1_Click()

Dim Conn As New jConnection

Dim TestFile As jFile

Dim DA As New jDynArray

Conn.Open "host", , "TEST", "Test035J"

Set TestFile = Conn.OpenFile("TEST")

DA.StringVal = "Attribute 1" & Conn.AM & "Attribute 2"

TestFile.Write "TESTREC", DA

End Sub

Replace the name "host" on the open line with the name of your host machine and the blank quote with the password for user TEST.

  1. Start the VB program and click the Command1 button. If your setup is correct, you should not get any errors while running the program
  2. On the host, execute ED TEST TESTREC from the jSH prompt in the TEST account and page the record. You should see the following output:

TESTREC

TOP

.P

TOP

001 Attribute 1

002 Attribute 2

Your test is now complete. The jRCS ActiveX library is self-documenting, so looking at it in VB‟s Object Browser should give the developer a clear idea of what functions are exposed and how they work.

For a VB.NET project, a reference would need to be added for "JRClient.NET".

The equivalent VB.NET code for the above would be:

Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click

Dim Conn As New jConnection

Dim TestFile As jFile

Dim DA As New jDynArray

Conn.Open("host", JConnection.JRCS_PORT, "TEST", "Test035J", "")

TestFile = Conn.OpenFile("TEST")

DA.StringVal = "Attribute 1" & JDynArray.AM & "Attribute 2"

TestFile.Write("TESTREC", DA)

End Sub

At the top of the form, the following line will also be required:

Imports jBASE.jrcs

otherwise explicit references will need to be used within your code.

 


jBASE Remote Connectivity Service