www.ibm.comLANDP Webpage

Shared File Server - Session 1

Introduction

The aim is for you to understand the relationship between the following files:

You will achieve this by adding data to the files and then you will examine the result of deleting each file.

You will use your own local Shared File server to complete this session. For this session you can use any LANDP platform as your workstation, although we wrote this hands-on session using DOS, OS/2 and Windows platforms.

All the exercises use the System Verification Program, SVPCPRB.

What you need to know before you begin

This Shared File Hands-On session uses the Shared File configuration that is used in the Installation and Customization Hands-On.

Summary of Steps

Creation of log, data and index files

In this exercise you will create the log, data and index files that relate to the database definition.

If LANDP is loaded, then you need to unload it. To unload LANDP you enter, at the command line (C:\LDP), EHCFREE SPV /F.

Once you unload LANDP you need to delete these files:

  • C:\LDP\LOG.DAT
  • C:\LDPSHFL\LDPDATA.DAT
  • C:\LDPSHFL\LDPDATA.IX1
  • C:\LDPSHFL\LDPDATA.IX2
  • C:\LDPSHFL\LDPDATA.IX3

    Before we can continue, you must set up the environment variables that the Shared File server uses to locate its log file. You can do this by entering, at the command line, set LOGPATH=C:\LDP\.

    You can now reload LANDP, as normal, using the AUTOFBSS file that you can find in the directory C:\LDP. What do you see happening?

    After you load LANDP, change to the directory C:\LDPSHFL and list the contents. What files are present?

    Now, we need to create the log file. You should return to C:\LDP directory and then run the command GENLOG. Once you have run GENLOG, list the contents of the directory C:\LDPSHFL. Has the content of the directory changed?

    You can look for the file LOG.DAT in the C:\LDP directory if it exists, note the size of it.

    From the directory C:\LDP, you need to run the command OPENLOG to make the Shared File Server usable.

    Note, in the exercise above you loaded LANDP and then you created the log file. However, you can create the log file before loading the Shared File server. In this case, you will not need to run OPENLOG to make the Shared File server usable.

    Summary

    You will see from these steps that loading the shared file server does not necessarily create the data and index files. It depends upon the contents of the log file, if this does not exist then the Shared File server does not create the new data and index files. If the log file exists when you load LANDP then the Shared File server will create the data and index files, if they do not exist, at load time.

    Log, data and index file updates

    In this exercise, you will add records to the Shared File using the SVPCPRB utility. You will see how the log, data and index files are affected.

    First, you will need to open the Shared File server and create a transaction by issuing the functions:

    The IS function inserts records into the Shared File using a Program Control Block (PCB) to locate the key and file that the Shared File server will use. Using SVPCPRB, you should insert records to the Shared File using the PCB ACCNUMB. Whilst you are inserting records, check the contents of the C:\LDPSHFL directory and the size of the log file (C:\LDP\LOG.DAT). You should continue to insert records and examine how the file sizes grow.

    How many records do you insert before the data files (C:\LDPSHFL\*.DAT) change size?

    At this time, the Shared File server has not committed the records that you inserted. To commit the records to the Shared File you need to issue either:

  • CP - Checkpoint, or
  • ET - End Transaction.

    Does using the read functions, GU, GN, GP, HU and so on, affect the size of the files?

    To close the transaction and the Shared File server, you should issue the functions:

  • ET - End Transaction, and
  • CO - Close On-line, and
  • RF - Revoke Function.

    After processing an RF function the Shared File server can not do any useful work until it you open it using the GF function.

    Examine the contents of the files LDPDATA.IX1,IX2 and LDPDATA.DAT. What purpose do you think the *.IX* files serve?

    Summary

    The Shared File server updates the log file every time there is change to the database. In the next exercise you will use the TYPELOG command to display the contents of the log file. Everytime the Shared File server adds a record, the size of the data file grows. For this session the record size is 38 bytes, however minimum size used by LANDP is 62 bytes plus a header for each record. You will see that the entire data record is present in the LDPDATA.DAT file.

    The index files, IX1 and IX2, do not grow when you add a record. Instead, they expand in blocks. How quickly they grow depends upon the size of the key fields. In the case of this database, the key field for LDPDATA.IX2 is 12 bytes long, whereas the key field for the LPDDATA.IX1 is 20 bytes long. Because LDPDATA.IX2 uses a 12 byte key field, it can contian more entries in each block than the LDPDATA.IX1 file. Therefore, the LDPDATA.IX1 file grows at a faster rate than the LDPDATA.IX2 file.

    Although the user should not examine these files directly, you see that the index files contain only the data from the relevant key fields plus additional control bytes. For each key field that you define during customisation, the Shared File server creates one index file. LANDP uses the database definition name as the file name of the data and index files.

    Typelog and typestat utilities

    In this exercise you will use the TYPELOG and TYPESTAT utilities to view the log file and information about the use of the Shared Files.

    To display the log file you use the command TYPELOG; you can find a full explanation of this utility in the LANDP manuals. TYPELOG produces a list of transactions that a specified workstation or all workstations performed. You can use the re-direction operator to read this information more easily. Therefore, from the C:\LDP directory enter the command:

    TYPELOG > LOG.LST.

    You can use a text editor to view the file, LOG.LST. Check that the IS functions and their data from the previous exercise appear. Answer the questions:

      1. Do all the functions from the previous exercise appear?
      2. What is the relationship between the value of RBA and length?
      3. Why does the length of the record in the log not match that of the data length of the record you entered into the SVPCPRB panel?
    The TYPESTAT utility provides you with a set of statistics from the Shared File server after it has been closed. For this utility to work you must have loaded and used the Shared File server with the 'Creation of Statistics File' option. The Shared File server uses the '/E' load parameter to gather statistics. You can also define this during customisation. If the option is chosen, the Shared File server creates a file with the extension EST. This option does affect the performance of the Shared File server, since the EST file is written to each time the Shared File server performs an operation.

    LANDP Shared File configuration files

    In this exercise you will learn about the Shared File server's configuration files.

    The customisation process creates the Shared File configuration files, that contain all the information regarding the database. Corruption or loss of these files will result in LANDP being unable to load the Shared File server.

    Once customisation creates these files, their contents do not change, however they are renamed when you load LANDP for the first time. The reason for this renaming is to protect existing files, thus avoiding accidental overwriting of them.

    These files have the extension of:

  • DBN or DBD - database definition file; and
  • PCN or PCB - program control blocks file.

    We will now show you the content of these files, however, you must not edit the content of these files. Otherwise, the Shared File server will not be able to read the data, index or log files.

    First, we must make sure that the Shared File server is closed and that LANDP is unloaded. You need to change to the directory C:\LDP to unload LANDP and to view the Shared File configuration files.

    List the files in the C:\LDP directory with the extension DBD. How many are there?

    Carefully use an editor to view the contents, but you must not change the contents of a *.DBD file. What do you recognize?

    List the files in the C:\LDP directory with the extension PCB. Again, Carefully use an editor to view the contents, but you must not change the contents of a *.PCB file. What relationships do you see between its contents and that of the DBD file?

    Summary

    Customisation produces the Shared File configuration files with the extensions DBN and PCN. When you load LANDP for the first time, NEWCFG checks that there is no existing DBD or PCB files in the current directoty. If NEWCFG does not find these files, it will rename the DBN and PCN files to have the extensions DBD and PCB.

    The DBD file contains the data that the Shared File server uses to define the database. The PCB file contains the data for defining the program control blocks that the Shared File server will use to access the database in an indexed sequential manner. Only one DBD and one PCB file exist for each Shared File server. These files must reside in the directory from which you load LANDP, if they are moved errors may result at load time.

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