www.ibm.comLANDP Webpage

Shared File Server

Introduction

The shared-file server provides database support, enabling applications in a LANDP workgroup to access records in shared files. The shared-file server enables multiple applications to read the same file simultaneously, but prevents one user from changing a record while another user is changing it. A LANDP workgroup can support several shared-file servers. However, only one shared-file server can be loaded in a LANDP workstation.

This tutorial will show you how to use the Shared File server that you configured during the LANDP Installation and Customization Tutorial to manage customer records.

Summary of Steps

What you Need to Know Before you Begin

This tutorial makes use of the shared file profile that you customize in the LANDP Installation and Customization Tutorial. Please run through the Installation and Customization tutorial before starting on this one.

Starting the Shared File Server

If LANDP is already loaded from the previous session, then you do not need to perform this step and can proceed to the next section, Using the Shared File Server.If you want to stop LANDP anyway you should type the following at the command prompt:

CD C:\LDP
EHCFREE SPV /F

The Shared File server uses a log file at the location specified in the LOGPATH environment variable. In this tutorial we will place the log file in the same place as the LANDP files. Type the following at the command prompt to configure the Shared File server log:

CD C:\LDP
SET LOGPATH=.
GENLOG

You can now start the LANDP system in the usual way by typing AUTOFBSS.

Using the Shared File Server

The Shared File server application programming interface (API) is comprehensively documented in chapter 14 of the LANDP Programming Reference. You should consult this manual during this tutorial.

Start the SVPCPRB program by typing SVPCPRBN at the command prompt. Select "Send CPRBs" from the Verify menu to get to the main panel.

You must start a client session on LANDP by issuing an IN request to the LANDP Supervisor server as follows:

Press the "Send" button to the right of the panel to send the request. Make sure the return code panels show OK, indicating the function was successful. If they do not, you should consult chapter 6 of the LANDP Problem Determination Manual.

Before performing transactions on a Shared File server, a client to initialise it's Shared File session. We will use an on-line session, meaning that the records can be locked one at a time, enabling multiple clients to alter the database simultaneously.

To open an on-line session, issue a GF and an OO request to the Shared File server as follows:

You can use this tutorial to perform the following record operations:

The record format, and the PCB field names that were customized for this tutorial are as follows:

ACCNAME
Text, 20 Chars
ACCNUMB
Numerical, 12 Chars, Unique
BALANCE
Binary, 12 bytes

Inserting Records

To insert a record, you use the Shared File server IS function. You also have to enclose the function in BT and ET requests to mark the beginning and the end of the transaction. Insert a record into the Shared File server as follows:

In the following image the record itself is placed in the Request Data Area. Since the BALANCE field, starting at offset 32, is a binary field, the field will contain the number that corresponds to 12 ASCII space characters. If you wish to place a sensible value in this part of the record, you have to switch to hexadecimal mode by pressing the "Hex" mode button on the right of the screen.

Retrieving Records

To retrieve a single record using a key, you can use the GU (Get Unique) function call. Since GU does not lock or change any records, you do not need to issue a BT or ET function call. Retrieve the record previously added as follows:

Updating Records

To update a record, you need to lock the required record using FU or HU, and replace it using RP. Because you are modifying the record you need to enclose the operation within BT and ET functions.

Issue a BT function as before, then issue the following requests:

The account name has now been changed from "MR SMITH" to "MRS SMITH". Since the ACCNUMB field is the primary key, you cannot replace the record with one that has a different value for ACCNUMB.

To finish the transaction and commit the update, issue an ET to the Shared File server as before. If you do not want to complete the update, you can also issue a roll-back (RB) function. See the LANDP Programming Reference for more details.

Deleting Records

Deleting records is done in the same way as updating them. Hold the record as you did for the previous example, and issue the DL function call to delete the record as follows. Don't forget to issue a BT request first.

The record is only deleted once an ET request is made to the Shared File server.

Introduction New to LANDP? Make the most of LANDP Solving LANDP problems Feedback