------------------------------------------------------------------------------------------- * ** Routine to open file for low-level processing *** *: NAME: y1FLOpn (tcFile) *: Description: Low level file processing. *: Open low level file. *: Other: Refer to Flow_All.Prg *: Parameters: tcFile = Low level file path & name to open. *: Returns: lnFile = Low level file handle. *: Defaults to -1 on error. FUNCTION y1FlOpn LPARAMETERS; tcFile LOCAL; lcErrMsg,; lcFile ,; lnFile lcFile = tcFile lcErrMsg = [] *--Processing .............................................................. *-- Open ASCII input file IF FILE(lcFile) && Make sure input file is present lnFile = FOPEN((lcFile)) && Input file IF lnFile < 0 && Ck for low-level file open error lcErrMsg = y1FLErr(FERROR()) && Encountered error lnFile = -1 && Indicate error ENDIF ELSE && Did not find file lcErrMsg = [--> ERROR: Input file not found: ] + lcFile lnFile = -1 && Indicate error ENDIF *--Check for error IF lnFile < 0 =y1Msg01(; [File error encountered!] + CHR(13) +; lcErrMsg,; [Low Level File Processing]) ENDIF ------------------------------------------------------------------------------------------- * ** Routine to handle error for low-level processing *** *: NAME: y1FLErr (tnFErr) *: Description: Low level file processing. *: Error routine. *: Other: Refer to Flow_All.Prg *: Parameters: tnFErr = AscII file error number *: Returns: lcErrMsg = Error message FUNCTION y1FlErr PARAMETER tnFErr *--Set-Up .................................................................. LOCAL ; lcErrMsg,; lnFErr lnFErr = tnFErr *--Processing .............................................................. DO CASE CASE lnFErr = 2 lcErrMsg = [File Not Found] CASE lnFErr = 4 lcErrMsg = [Too Many Files Open -- Out of Handles] CASE lnFErr = 5 lcErrMsg = [Access Denied -- File Already Open, or Read-Only] CASE lnFErr = 6 lcErrMsg = [Invalid File Handle Given] CASE lnFErr = 8 lcErrMsg = [Out Of Memory] CASE lnFErr = 25 lcErrMsg = [Seek Error -- Tried to seek before start of file] CASE lnFErr = 29 lcErrMsg = [Disk Full] CASE lnFErr = 31 lcErrMsg = [Error Opening File or General Failure -- EOD Encountered] OTHERWISE lcErrMsg = [Unknown Error] ENDCASE *--Clean-Up ................................................................ RETURN lcErrMsg -------------------------------------------------------------------------------------------======================================================================