9.130 LOAD_FILE_DATA

Note: Built-In Function Rules     Usage Options

This Built-In Function expects to be executed on the same machine as the OAM. Both the BIF and the OAM need to access the input file. If you execute the BIF from a local Function but redirect the File to SuperServer, it is your responsibility to ensure that the input filename is valid on both the client and the server.

Of course, while loading data into a file it is not expected that an IO is still in use from, say, calling LOAD_FILE_DATA from within a SELECT loop over the same file! At the completion of loading the file the OAM is completely closed, terminating all existing transactions.

Arguments

No.

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

The LANSA File Name

1

10

 

 

2

A

Opt

Use Rules/Triggers ?

Y will cause all rules, triggers and batch control logic to be processed, any other value will load the data without processing rules, triggers and batch control logic.

Default = N

1

1

 

 

3

A

Opt

Input File Path/Name

Default Value = ....\X_ppp\source\[File Name].dat

1

256

 

 

4

A

Opt

Ignore Duplicate Keys

Y - duplicate keys found when attempting to add a record will cause the record to not be added and a message to be added to the job message queue.

N - duplicate keys will cause the load to end with an error

Default = Y

 

 

 

 

5

A

Opt

Y\N Check for OAM

Default = N

1

1

 

 

6

A

Opt

Delete .dat file and BLOB/CLOB files after a successful load (no errors and no warnings about missing BLOB and CLOB data).
Default - N.

1

1

 

 

7

A

Opt

If BLOB or CLOB field exist on the file, and the .dat file indicates a filename for the field, LOAD_FILE_DATA will automatically look for the file and load the data into the database if the file is found. This flag controls what to do if an expected file is not found.
Default = W, meaning issue a warning message and set field to default (*SQLNULL).
If Y, set field to default (*SQLNULL).
If N, give a fatal error and abort.

1

1

 

 

8

A

Opt

CTD Location Level
A= All (Partition + System).
P = Partition Level only.
S=System Level only.

Default is A.

1

1

 

 

 

Return Values

No.

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Return Code

OK = File successfully loaded

VE = Validation Error in load of the file

ER = File load failed (possible causes - flat file not found, a trigger failed to execute correctly)

NT = No table exists

NO = No OAM. File does not exist or is not compiled.

NO only returned when input option 5 is set to Y

2

2

 

 

 

Issues related to OAMs built prior to V10.0

When UNLOAD_FILE_DATA has been used with an OAM built prior to V10.0, then a CTX file must exist for V10.0 LOAD_FILE_DATA to work. Note that a the following steps to manually create a CTX file are not required when data is created by a V10.0 OAM.

Follow these steps to create a CTX file. V9.1 to V10.0 has been used in this example:

1.  Return to V9.1 of LANSA that generated the data file.

2.  Make a copy of the relevant V9.1 .CTD (Common Table Definition) file with an extension of .CTX (ex-Common Table Definition).

3.  Copy the V9.1 .CTX file into:  ...\x_win95\X_lansa\X_<partition>\Source\

     For example: ...\x_win95\X_lansa\X_<partition>\Source\<filename>.CTX

4.  Use the LOAD_FILE_DATA Built-In Function to load the unloaded data.

5.  Delete the CTX file after using LOAD_FILE_DATA as it is no longer needed.