The FILEERROR function returns information about the first error that occurred when you are processing a record from an input file with the data reading statements FILEREAD and FILEVIEW. It can tell you what type of error occurred and where Oracle OLAP was in the record. The keyword you specify as an argument determines the kind of information that is returned.

You should call FILEERROR once to find out the type of error. Then, you can call FILEERROR again to get more details about what caused the error. The return values for the type of error are also FILEERROR keywords. When FILEERROR returns a value other than NA, then you would probably call FILEERROR a second time using the return value itself as an argument.

The abbreviation for FILEERROR is FILEERR

Return Value

Varies depending on the specified keyword.





Returns a text expression that specifies the type of error that has occurred. The types of errors and their meanings are listed in Table 7-9, "Types of Errors Returned by FILEERROR".

Table 7-9 Types of Errors Returned by FILEERROR

Return Value Meaning


The data reading statements tried to set the status of a dimension (through an implicit or explicit MATCH attribute), but the specified position or value did not exist.


No error occurred in the processing of the current record.


The data reading program tried to read from an invalid location in the record. A POSITION error can occur when the field or column is before the beginning of the record or when the field extends past the end of the record. An error beyond the end of the record occurs only for binary or packed data; for symbolic (textual) data, the data reading statements pad short records with blanks.


The value could not be converted to the requested data type. For packed data, this means the record had an invalid hexadecimal digit.


The data reading statements specified an invalid field width. Invalid widths depend on the format of the data, which can be symbolic, packed, or binary:

  • For symbolic format, the width is invalid when it is less than 1 or when it is NA. Note that NA is acceptable for ID data.

  • For packed format, the width is invalid when it is less than 1, greater than 8, or NA.

For binary format, the width requirement depends on whether the data is INTEGER or DECIMAL (floating-point). Integer data must have a width of 1, 2, or 4. Decimal data must have a width of 4 or 8.


Returns an INTEGER that is the column number (for RULED records) or field number (for STRUCTURED records) when the error occurred.


Returns an INTEGER that is the current field width. It will return NA when NA was specified as the width or the error was a POSITION error. A POSITION error stops processing before the width can be evaluated.


When the error type is VALUE, it returns a text expression that is the value that could not be converted. When the data is packed, the invalid value is shown as hexadecimal escapes. When the error type is DIMENSION, it returns the value that did not match any existing dimension value. For other error types, it returns NA.


When the error type was DIMENSION, it returns a text expression that is the name of the dimension that had no matching dimension values. For other error types, it returns NA.


Flow of Control

When an error occurs in FILEREAD or FILEVIEW, processing of the current record stops and Oracle OLAP displays an appropriate error message. Then, when your program has a trap label, control branches to the label where you might call FILEERROR to investigate the problem. When you branch back to a FILEREAD or FILENEXT function, processing continues with the next record. When there are more errors in the record, they will not be evaluated.

Displaying Error Messages in the Current Outfile

Set ECHOPROMPT to YES in your data reading program when you want error messages to be displayed in the current outfile. When the error occurred during FILEREAD or FILEVIEW, any evaluation by FILEERROR occurs after the error message.


Example 7-88 Error-Handling with TRAP

This example shows a sample trap label (ERROR:) and the error-handling code that follows it. (For information on error trapping and trap labels, see the TRAP command.) The code checks whether the file has been opened. If so, it checks whether the error that caused the branch is a data reading error. When it is, the program calls FILEERROR in a SHOW command to display information about the error. The body of the program (not shown) contains code that opens the file and assigns a file unit number to the variable fil.unit. ERRTYPE is a local variable that is declared at the beginning of the program.

IF fil.unit EQ NA
    POPLEVEL 'save'
      THEN SHOW JOINCHARS('Error in record ' RECNO(fil.unit) -
         ' in column ' FILEERROR(POSITION) ': ' -
FILECLOSE fil.unit