Modular Software - Home PicLan-IP - Home

Opening mv/WEB Files in Named Common

Documentation for build 2.0.0.132
April 23, 1999

mv/Web has a number of restrictions on the use of mv/BASIC file variables. On host systems that support named common there is a technique that can be used to pre-open application data files and then easily access these data files from within an application. Setting up this involves several steps:

Defining a Named Common INCLUDE

The first step that you should take is to build an INCLUDE item that contains the file variables for a particular application. This include item should be stored in a standard source code file (not in a source code file that is used by PLZ) and probably in the same source code file that contains other mv/BASIC source code used by your application. Here is an example include that defines five file variables:

BP AR.FILES.INCLUDE


      REM Include for named common file variables for application AR
* * * COMMON /ARFILES/ CUST.FILE COMMON /ARFILES/ INV.FILE COMMON /ARFILES/ CTRL.FILE COMMON /ARFILES/ INDEX.FILE COMMON /ARFILES/ CUST.XREF.FILE

Defining an INIT Subroutine

After you have defined a named common INCLUDE, you need to write a subroutine to open these files.
BP AR.FILES.OPENSUB


      SUBROUTINE AR.FILES.OPENSUB
*
*
*
      INCLUDE BP AR.FILES.INCLUDE
* OPEN 'CUSTOMERS' TO CUST.FILE ELSE STOP 201,'CUST.FILE' OPEN 'INVOICES' TO INV.FILE ELSE STOP 201,'INVOICES' OPEN 'CTRL' TO CTRL.FILE ELSE STOP 201,'CTRL' OPEN 'INDEX' TO INDEX.FILE ELSE STOP 201,'INDEX' OPEN 'CUST.XREF' TO CUST.XREF.FILE ELSE STOP 201,'CUST.XREF' * RETURN

After you write this subroutine, compile it with the standard system BASIC (or COMPILE) verb and catalog it so that it can run within the PICLAN-IP account.

Setting up PicLan-IP so that the INIT Subroutine will be Called at Startup

You can then setup the PicLan-IP server so that your initialization subroutine is called by adding the following line to the PLIP.CTRL CONFIG item:

PLIP.CTRL CONFIG


...
INIT SUB=AR.FILES.OPENSUB
...

If you have multiple web applications that need unique file blocks, you can call more than one initialization subroutine in this manner. Just be sure to use different names for the named common blocks with each application.

Using the Open Files Within an mv/Web Application.

Your mv/Web application can use these file variables by simplying INCLUDING the pre-built include item and then using the file variables directly with file I/O statements:

      _SUBROUTINE WEBSUB
*
*
*
      INCLUDE BP AR.FILES.INCLUDE
*
...
      READ CUST.REC FROM CUST.FILE . CUST.ID ELSE
...

Other Issues Dealing with Named Common File Usage

If you use these techniques, you need to insure several things:

Modular Software - Home PicLan-IP - Home
© Copyright 1996-1999  Modular Software Corporation.All rights Reserved.