How to use PERMFILOVR?

Date:13 January 2003
Product/Release:LANSA for iSeries
Abstract:From member PERMFILOVR in source file DC@F28 in the LANSA Data library
Submitted By:LANSA Technical Support

The following contains information and examples on how to use LANSA's Permanent File Overrides facility.

This facility is activated by inserting the string "*PERMFILOVR" into LANSA data area DC@OSVEROP.

Firstly you need to create a source physical file called PERMFILOVR.

CRTSRCPF PERMFILOVR

You can create this anywhere. LANSA looks for this file in the *LIB at run-time. If the file is found, LANSA reads the first member to find file override information. If you want to make this override information partition specific then put this file into the partition data or module libraries.

You can edit file PERMFILOVR using SEU. Records in the first member must be either comments or file override details:

  • A ";" in the first position indicates a comment line.
  • Any line that does not start with a ";" is a line containing file override details.

When you specify file override details you are telling LANSA that "every time I use this file, I really want you to use this other file". This is useful when you need to use files with 10 character file names, files with a "." in their name, etc.

The file override details are specified as:

From File   To File     To Library
1234567890  1234567890  1234567890

(Notice there is a space left between each name).

Example:

CUSTMAST CUSTMASTER MYLIBRARY

Example with layout in comments:

;From File   To File      To Library
;234567890   1234567890   1234567890
CUSTMAST     CUSTMASTER   MYLIBRARY

You can actually have 2 files specified on one line:

From File  To File    To Library From File  To File    To Library
1234567890 1234567890 1234567890 1234567890 1234567890 1234567890

eg:

;From File To File    To Library From File  To File    To Library
;234567890 1234567890 1234567890 1234567890 1234567890 1234567890
ITEMMAST   ITEMMASTER DATALIB    ORDERH     ORDER.HEAD DATALIB

You can put just one file on each line and have a comment on the right hand side. To indicate a comment, put a ";" where the first character of the second "To File" name would be.

eg:

;From File To File To Library     Comment
;234567890 1234567890 1234567890  1
ITEMMAST   ITEMMASTER DATALIB     ; Item master file
CUSTMAST   CUSTMASTER MYLIBRARY   ; Customer Master

If you do not want the library name to be overridden then leave it blank. You can also use the special values *LIBL and *CURLIB.

eg:

;From File To File    To Library Comment
;234567890 1234567890 1234567890 1
ITEMMAST   ITEMMASTER            ; Item master
CUSTMAST   CUSTMASTER *CURLIB    ; Customer master
ORDERH     ORDER.HEAD DATALIB    ; Order Header
ORDERD     ORDER.DET  *LIBL      ; Order Detail

You need to specify logical views as well. LANSA will not override the logicals unless you tell it to.

eg:

;From File To File To Library    Comment
;234567890 1234567890 1234567890 1
ITEMMAST   ITEMMASTER *LIBL      ; Item master
ITEMMAL1   ITEMMASTL1 *LIBL      ; Item master by Item
ITEMMAL2   ITEMMASTL2 *LIBL      ; Item master by Class
ITEMMAL3   ITEMMASTL3 *LIBL      ; Item master by Category
ITEMMAL4   ITEMMASTL4 *LIBL      ; Item master by Status

Comments and Warnings

  • The maximum amount of file overrides is 500. If you specify more than 500 overrides then the ones past 500 will be ignored.
  • LANSA will not check the file overrides you specify. If you do not put the file overrides in the correct columns (From File, To File, etc) then you will get errors at run-time. Also, if you use invalid object names you will get errors at run-time.
  • The first I/O module will call program M@PEROVR which reads file PERMFILOVR and loads the file override details into memory.
  • As file PERMFILOVR is only read once, if you change PERMFILOVR then you will need to exit LANSA and RCLRSC or SIGNOFF before starting LANSA again or your changes will not take effect. The same goes for when LANSA Client or LANSA/Server are used, the sessions must be ended and started again if file PERMFILOVR is changed.
  • For better memory (PAG) management you can call M@PEROVR before starting LANSA. This will load M@PEROVR early in the PAG so memory is potentially saved. To load M@PEROVR, call it like this...

    CALL M@PEROVR X'00'

    The Hex 0 parameter tells M@PEROVR to do nothing but load and stay active in memory. For LANSA/Server and LANSA Client, this call can be put in a program called LCXP9000. You create this program which LANSA knows is a "User Exit" that must be called when LANSA Client and LANSA/Server starts. If LCXP9000 does not exist, LANSA traps the error on the call and LANSA/Server or LANSA Client continue normally.

Examples:

How to setup files to be overridden...

Example 1 – A file with a 10 character name (FILE10NAME)

  1. Create a special library for dummy files. This library will just be used for file definitions (no DATA). In this example, the library is called DUMMYLIB.
     
  2. Use CRTDUPOBJ to copy FILE10NAME to DUMMYLIB. Also copy the logicals attached to FILE10NAME into DUMMYLIB (FILE10NAM1 and FILE10NAM2). You only need the file definitions so you do not need to copy the data.
     
  3. Use DSPDBR to make sure that logicals FILE10NAM1 and FILE10NAM2 in DUMMYLIB are attached to file FILE10NAME in DUMMYLIB. This is important for when the file is loaded into LANSA.
     
  4. Rename FILE10NAME in DUMMYLIB and its logicals so that the files can be loaded into LANSA.

    In this example:
    FILE10NAME becomes FILE10NA
    FILE10NAM1 becomes FILE10N1
    FILE10NAM2 becomes FILE10N2

    It is important to rename the files after they have been copied to DUMMYLIB. If the physical file does not have the same name as the one in the original library then the logicals will not attach to it when they are copied. They would remain attached to the original file.
     
  5. The files can now be loaded into LANSA. Define the files in LANSA as OTHER files. Load their external definitions and make the files operational so that I/O modules are created. Note that "*PERMFILOVR" should be in data area DC@OSVEROP before the files are made operational.
     
  6. Create/maintain file PERMFILOVR. The following entries would be inserted:
    FILE10NA FILE10NAME *LIBL
    FILE10N1 FILE10NAM1 *LIBL
    FILE10N2 FILE10NAM2 *LIBL


    A specific library could be specified instead of *LIBL.
     
  7. When the files have been made operational, you can use them throughout LANSA. You use the file names that have been defined to LANSA. At run-time, LANSA will handle the overrides to the correct files because you have file PERMFILOVR in the run-time library list (*LIBL).

Example 2 – A file with a "." in its name (FIL.X)

  1. Create a special library for dummy files. This library will just be used for file definitions (no DATA). In this example, the library is called DUMMYLIB.
     
  2. Use CRTDUPOBJ to copy FIL.X to DUMMYLIB. Also copy the logicals attached to FIL.X into DUMMYLIB (FIL.X1 and FIL.X2). You only need the file definitions so you do not need to copy the data.
     
  3. Use DSPDBR to make sure that logicals FIL.X1 and FIL.X2 in DUMMYLIB are attached to file FIL.X in DUMMYLIB. This is important for when the file is loaded into LANSA.
     
  4. Rename FIL.X in DUMMYLIB and its logicals so that the files can be loaded into LANSA.

    In this example:
    FIL.X  becomes FILEX
    FIL.X1 becomes FILEX1
    FIL.X2 becomes FILEX2

     
    It is important to rename the files after they have been copied to DUMMYLIB. If the physical file does not have the same name as the one in the original library then the logicals will not attach to it when they are copied. They would remain attached to the original file.
     
  5. The files can now be loaded into LANSA. Define the files in LANSA as OTHER files. Load their external definitions and make the files operational so that I/O modules are created. Note that "*PERMFILOVR" should be in data area DC@OSVEROP before the files are made operational.
     
  6. Create/maintain file PERMFILOVR. The following entries would be inserted:
    FILEX  FIL.X  *LIBL
    FILEX1 FIL.X1 *LIBL
    FILEX2 FIL.X2 *LIBL

     
    A specific library could be specified instead of *LIBL.
  7. When the files have been made operational, you can use them throughout LANSA. You use the file names that have been defined to LANSA. At run-time, LANSA will handle the overrides to the correct files because you have file PERMFILOVR in the run-time library list (*LIBL).

Important note for the above examples

LANSA uses I/O module programs to access files. The I/O module programs must be in the *LIBL at run-time. There is one I/O module program for each physical file and it has the same object name as the physical file. By default, LANSA will put the I/O module into the same library as the file (DUMMYLIB). This will mean that DUMMYLIB will have to be in the *LIBL at run-time.

Some alternatives

  1. Change LANSA's database file attributes for the file so that the I/O module will be put into the partition module library. This alternative is only valid if the partition's module library is not DUMMYLIB.
     
  2. Copy the I/O module to another library which will be in the *LIBL at run-time. This alternative is OK if you remember to do this every time you re-compile the I/O module.