function long file_exists( string file_name ) !labels !constants %include "$rmsdef" %from %library "sys$library:basic$starlet.tlb" %include "$ssdef" %from %library "sys$library:basic$starlet.tlb" !types !variables declare long sys_status, rms_status, context declare string result_spec !procedures !functions external long function lib$find_file, & lib$find_file_end( long ) sys_status = lib$find_file( file_name by desc, & result_spec by desc, & context by ref,,,, ) select sys_status case = rms$_normal file_exists = 1% sys_status = lib$find_file_end( context by ref ) if (sys_status and 1%) = 0% then call lib$signal( sys_status by value ) end if case = rms$_fnf file_exists = 0% case else file_exists = 0% call lib$signal( sys_status by value ) end select end function