Please enable JavaScript to view this site.

ESL Documentation

FILEIO Subroutine

Set a string variable to an error message.

call GetError(ERROR_LEVEL_IV, MESSAGE_SV)

ERROR_LEVEL_IV

An integer variable that specifies an error code. To set ERROR_LEVEL_IV, copy the value of the built-in function errorlevel to it (see "Example").

MESSAGE_SV

The name of a string variable to contain a short error message after the call to GetError( ) is made.

Description

If a File I/O Library subroutine encounters an error, the error level is set to the number of the error encountered. The value can be retrieved through the built-in function errorlevel. When no errors are detected, errorlevel contains the value of the constant FIO_E_ERRORFREE (i.e. zero). GetError( ) sets a string variable to the error message associated with the error level passed to it.

Errors

FIO_E_UNKNOWN

The errorlevel value is not known to the FileIO library.

Example

string FileName is "input.txt"

string Read is "read"

string Message

integer ErrorLevel

integer FileIDin

include "fileio.inc"

 

action ErrorHandler is

 copy errorlevel to ErrorLevel

 if (ErrorLevel != FIO_E_ERRORFREE) then

         call GetError (ErrorLevel, Message)

         send "An error was detected, Code= " ErrorLevel

                 "\n Error Message: " Message to errorlog

 end if

 

response to start

 call OpenFile (FileIDin, FileName, Read)

 action ErrorHandler