Page History
...
4. Create Definitions in LX_F47 and LX_F48
There There are two available methods for creating Definitions in LX_F47 and LX_F48.
...
b. Define your Built-In Function's arguments and return values into the IBM i based table DC@F48 as described in the Examples in Create your own 3GL Built-In Functions on IBM i for RDML Functions.
c. Optionally, design, code and test an IBM i based version of your Built-In Function. The LANSA Built-In Function facility is designed to be a generic interface between LANSA applications and multiple platforms.
| Note |
|---|
| Note: If you need to supply Built-In Functions that will eventually be required on multiple platforms, you may consider producing fatal error "stubs" for your Built-In Function(s) on all supported platforms. This means that if your Built-In Function is accidentally invoked on a non-supported platform (e.g. the IBM i) then a neat "fatal error" explaining the situation will result, rather than a more complex problem involving compile and/or run time linkage problems. |
d. Export the definition of your Built-In Function from the IBM i Repository using the standard LANSA REQUEST(PCMAINT) facility.
e. Import the definition of your Built-In Function into each Visual LANSA system that will need to use it. To do this, use the standard Visual LANSA import facilities from CD or shared folder. This facility will update SQL tables LX_F47 and LX_F48 with details of the Built-In Functions exported from the IBM i in step 4.
...
Method 2: Define the BIF via SQL directly in Windows
This This is an alternative method, which can be used where the IBM i IBM i is non-existent or if you are familiar with inserting and updating your database on the Windows/Linux platform using SQL statements. This method requires you to directly enter your definitions into the LX_F47 and LX_F48 files.
| Info |
|---|
| Inserting/updating records in the LX_F47 and LX_F48 internal LANSA tables via SQL, if not completed correctly, can potentially cause database corruption. If you require assistance with inserting/updating records in the LX_F47 and LX_F48 internal LANSA files via SQL, you should consult your Database Administrator. |
Example Example of an insert to file LX_F47
...
INSERT INTO "LX_DTA"."LX_F47"
...
VALUES('UD_AVERAGE',413,'
...
Get the Average','C','U_BIF413','N',2,1)
Example Example of an insert to file LX_F48
...
INSERT INTO "LX_DTA"."LX_F48"
...
VALUES('UD_AVERAGE','ARG',1,1,'A','
...
First Value','R','N',7,7,0,0,10,0,'')
5. If you are writing a BIF specifically for Windows or you require 64 bit support on Windows then you may find the LANSA User Defined BIF Wizard an easier method than the remainder of these steps 6 - 9. Instead go to Define Built In Functions with a Visual Studio Wizard It is particularly useful for existing Visual Studio users and when requiring more than one user defined BIF.
6. Create copies of the following files that are installed in your x_win95\x_lansa\source directory. Change the "NNN" portion of the name to the unique identifier assigned to your Built-In Function.
For For example, if you were making Built-In Function 445, and working from the C: drive then you might use these commands:
...
CD \X_WIN95\X_LANSA\SOURCE
...
COPY U_BIFNNN.* U_BIF445.*
These These are the files that are installed in your x_win95\x_lansa\source directory:
...
9. Compile your Built-In Function using one of the following examples depending on the platform you are using:
Compile your Built-In Function on Windows