AccessJournal is a LANDP client that accesses a LANDP Electronic Journal Server. It demonstrates programming the electronic journal server by performing several record level tasks. The client also uses some Supervisor wrapper methods, including the standard functions to connect and disconnect from LANDP.
To run AccessJournal, the sample client application, you need to customise an Electronic Journal server called ELECJO01, using a Shared File server called SHFILE01. The client expects the server not to provide separate session shared file data integrity. The vectors you should add to the COMMON.SPC are shown below:
RECDEF |
NAME=EJREC, DELIMIT='/', DECSEP='.' |
RECFIELD   |
NAME=CUSTNAME, LENGTH=20, FORMAT=C |
RECFIELD |
NAME=BALGPB, LENGTH=8, FORMAT=N, DECIMALS=2 |
SMGRPRF |
NAME=SYSMGR SMGRUSER USERID=SYSMGR, PASSWORD=SYSMGR |
EJOUPRF |
NAME=EJOURNAL, DATASETS=5, SEPSESS=Y, SHFLPRF=EJSHFL, DBDPATH=C:\EJPATH\, DBDPATH6='/var/opt/ibm/landp', SPLIT=128, KEY02=CUSTNAME |
EJOUREC |
RECNAME=EJREC |
To define your workgroup, create a directory in EHCCUS called LDPJAVA, and create a LANCONF.SPC file containing the following definitions:
LANCONF   |
NAME=LDPJAVA, WSNAMES=(EJ), DEFAULTS=GENERAL |
LWSCONF |
NAME=EJ, TYPE=NT, SERVER=SMGR, SERVER=ELECJO01, PAR&EJOU=EJOURNAL, SERVER=SFQUERY, SERVER=SHFILE01, PAR&SHFL=(EJSHFL,,3), SERVER=JAVA, PAR&JAVA=(Y), CLIENT=(SHFILE01,EJ), CLIENT=(ELECJO01,EJ) |
Validate and distribute the files for workstation EJ as normal, and copy the "landpjava" package from the tutorials directory to the workstation directory.
Start LANDP, making sure you first create the Shared File log, and compile the samples with the following command:
You can now start the sample application with the following command:
Having registered with the Java manager, the RemoteRequest object which is returned is used as a parameter to create new instances of the Supervisor, Shared File Server and Electronic Journal server classes.
The Supervisor server is needed for the connect() function to connect to LANDP services. The application then attempts to connect to the shared file server using the start() method of the SharedFileServer class, which if successful, creates a new SharedFileSession object, and puts it into on-line mode.
The application then tests whether the Electronic Journal server is operative using the getStatus method of ElectronicJournalServer.
Next, a new journal is opened for a set of transactions. This is a physical journal, corresponding to a single shared file. You are then presented with a simple set of options to manage records in the physical journal.
When inserting a record, a new ElectronicJournalRecord object is created with the data as a constructor. This is then passed to the addRecord function of the Electronic Journal class, along with the record format name and the transaction status. The transaction status indicates whether the current function is the first, middle, last or only within the transaction, and can only be specified if the separate session flag has been set during customisation.
When retrieving all of the records, searchRecord() with a preset search parameter is used to find the first record. The remaining records are then retrieved using a different preset search parameter until an exception is thrown indicating the end of the records.
Finally the disconnect() method of the Supervisor class is called to close the connection with LANDP.
The source code for AccessJournal is provided with this tutorial.