The Permanent File Overrides Facility

LANSA for i

The Permanent File Overrides Facility

LANSA's Permanent File Overrides facility allows you to specify that when a specific file is used, LANSA is to always use a different one. This override facility can be used for files with 10 character file names or files with a "." in their name as shown in the Examples.

The Permanent File Overrides facility is activated by specifying Y in the Allow permanent file overrides option of the System Settings Work with Execution and Security Settings. (This option inserts the string "*PERMFILOVR" into LANSA data area DC@OSVEROP.)

First you need to create a source physical file called PERMFILOVR using this command:.

    CRTSRCPF PERMFILOVR

 

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

You can edit file PERMFILOVR using SEU (STRSEU) or edit file (EDTF).

  • Records in the first member must be either comments or file override details.
  • A semi-colon (;) in the first position indicates a comment line.
  • Any line that doesn't start with a semi-colon is considered to contain file override details.
  • There must be a space between each name.
  • All file and library names must be in upper case.

Comments can be used to indicate the layout as shown in this example:

;From File To File    To Library

;234567890 1234567890 1234567890

CUSTMAST   CUSTMASTER MYLIBRARY 

 

Notice the space left between each name.

You can specify two files on one line:

;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 have just one file on each line with a comment on the right hand side. Use a semi-colon to indicate the start of the comment, as in this example:

;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, leave it blank. You can also use the special values *LIBL and *CURLIB as this example:

;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 must specify logical views as well. LANSA will not override the logical views unless you tell it to as shown here:

;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 Catagory

ITEMMAL4   ITEMMASTL4 *LIBL      ; Item master by Status

 

Comments and Warnings

  • The maximum number of file overrides is 2000. If you specify more than 2000 overrides then those over 2000 will be ignored.
  • LANSA will not check the file overrides you specify. If you do not put the file overrides into the correct columns (From File, To File, etc) then you will get errors at run-time. Also, using invalid object names will cause 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 it, for your changes to take effect you must exit LANSA and RCLRSC or sign off and start LANSA again. The same applies to LANSA Client or LANSA Open, the sessions must be ended and started again if file PERMFILOVR is changed.
  • As well as specifying Y for Allow Permanent File overrides, I/O modules must be rebuilt to enable use of the details in the PERMFILOVR file.
  • 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. Use this call to load M@PEROVR:

             CALL M@PEROVR X'00'

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

Examples

Override files with a 10 character name (FILE10NAME)

Override files with a "." in the name (FIL.X)

Override files 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). As you only need the file definitions, 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. (Remember that your file & library names must be in upper case.)

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 you must set the Allow permanent file overrides option to Y in the Work with Execution and Security Settings 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 file PERMFILOVR is in the run-time library list (*LIBL).

Override files with a "." in the 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 logical views attached to FIL.X into DUMMYLIB (FIL.X1 and FIL.X2). As you only need the file definitions, 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. (Remember that your file & library names must be in upper case.)

     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 you must set the Allow permanent file overrides option to Y in the Work with Execution and Security Settings 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:

  • 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.
  • Copy the I/O module to another library which will be in the*LIBL at run-time. Use this alternative only if you remember to do this every time you re-compile the I/O module.