Description

Sets a filing system error to be retrieved by the caller.

Syntax

status = Set_FSError()

See also

Set_Status() function , RevError.DatGet_Status functionFsMsg routine

Remarks

Status will always be 0 (success).

You can use Set_FSError to return filing system errors to the caller. Refer to Set_Status, which incorporates Set_FSError, and provides a more generic error handling method.

Set_FSError transfers the error status of the system variable @FILE_ERROR to the stored procedure status. Any error arguments present at @FILE_ERROR are also returned.

Example

*---- @FILE.ERROR field structure -------
 
Equate FSCODE$   To 1   ;*error or status code identifier
Equate FSMSG$    To 2   ;*error message data
Equate FSDETAIL$ To 3   ;*file system dependent detail data
 
If @FILE.ERROR<FSCODE$> Then
status = Set_FSError()
  Return
End
  • No labels

1 Comment

  1. To help better understand this function, it does not really return anything directly to the caller. It is a go-between function that takes the contents of @FILE_ERROR and makes it available to the Get_Status() function. For instance, consider this code:

    TableName = 'CUTOMER_FILE'   ; // Note, this is a misspelled table name.
    Open TableName to hTable else
        Status = Get_Status(StatusCode)
    end

    Even though the Open statement fails, Get_Status does not report any errors. Neither does Status(). This would need to be written this way:

    TableName = 'CUTOMER_FILE'   ; // Note, this is a misspelled table name.
    Open TableName to hTable else
        Set_FSError()
        Status = Get_Status(StatusCode)
    end

    Now the Status variable returns a 1 and StatusCode returns 401 @vm CUTOMER_FILE. Of course, @FILE_ERROR can always be checked directly. However, calling Set_FSError allows this error to be accessed by Get_Status so another caller can get access to it and @FILE_ERROR can be safely cleared or set by yet another statement. This might be useful if the current routine is written as a stand-alone utility that always clears @FILE_ERROR so that it does not adversely affect the programmer's calling procedure.