A LOB or XML file reference variable is
used for direct file input and output for a LOB or XML.
A LOB or XML file reference variable can
be defined in the following host languages:
PL/I (LOB only)
Since these are not native data types, SQL extensions are used and the precompilers generate the host language constructs necessary to represent each variable.
A file reference variable represents (rather
than contains) the file, just as a LOB or XML locator represents,
rather than contains, the LOB or XML data. Database queries, updates,
and inserts may use file reference variables to store or to retrieve
single column values. The file referenced must exist at the application
requester.
Like all other variables, a file reference
variable can have an associated indicator variable. Indicator variables
for file reference variables behave in the same way as indicator variables
for other data types. When a null value is returned from the database,
the indicator variable is set and the variable is unchanged. When
the indicator variable associated with a file reference variable is
null, the value of the referenced LOB or XML is null. This means that
a file reference variable can never point to a null value.
The length attribute of a file reference variable
is assumed to be the maximum length of a LOB or XML.
File reference variables are currently supported in the root (/), QOpenSys, and UDFS file systems. When a file is created, it is given the CCSID of the data that is being written to the file. Currently, mixed CCSIDs are not supported. To use a file created with a file reference variable, the file should be opened in binary mode.
For more information about file reference variables, see the SQL programming topic collection.