Scroll Top

Managing Solr from AS400 programs

When you’re working with AS/400 applications that prepare the data for your Solr index, you probably want to trigger some data-import actions in your Solr application.

In order to perform some pre-defined actions, you will want to introduce an OS/400 program to have an easy tool with which your AS/400 programmers are familiar to work with. The tool will allow them to quickly trigger some pre-defined actions without the need to learn the Solr API.

It will allow your AS400 programmers to perform the action by a command like:
CALL PGMNAME ‘item-delta-import’

To enable that, you can build quickly a simple solution, based on 3 “objects”: a CL program, a java class and a properties file.

The CL program is just a wrapper program with 1 entry parameter: the action to be executed. The CL program brings the java class and the properties file (both resides on the IFS) together and makes them available as an AS/400 object.

The java class takes the entry parameter to indicate the pre-defined action that needs to be triggered on the Solr instance (this parameter was provided as the entry pararmeters of the CL class). The class looks for the action in the properties file and forwards the found Solr command to the Solr instance. This Solr instance is also defined in the same properties file.

This is a simple, flexible solution that allows controlling your Solr instance from the well-known “green-screen”. More info (and example class/properties file), please contact us. All feedback is welcome.

CL source:

FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8          
    *************** Beginning of data ***********************************************************
0001.00           PGM     PARM(&ACTION)                                                130809 
0002.00                                                                                130809 
0003.00           DCL     VAR(&ACTION) TYPE(*CHAR) LEN(30)                             130809 
0004.00           DCL     VAR(&CMD) TYPE(*CHAR) LEN(500)                               130809 
0005.00                                                                                130809 
0006.00           CD      DIR('/home/sr-sl/http/')                                     130809 
0007.00           CHGVAR VAR(&CMD) VALUE('java -cp +                                   130809
0008.00                        ''./sr_sl-http-tools-1.0.0.jar:./httpclien+             130809 
0009.00                        t-4.2.5.jar:./httpcore-4.2.4.jar:./commons-+            130809 
0010.00                        logging-1.1.1.jar:./'' +                                130809 
0011.00               +                130809 
0012.00                        ./ ' +                      130809 
0013.00                        *CAT &ACTION )                                          130809 
0014.00                                                                                130809 
0015.00           STRQSH CMD(&CMD)                                                     130809 
0016.00                                                                                130809 
0017.00 END:      ENDPGM                                                               130809 
    ****************** End of data **************************************************************

Related Posts