FILNM
Return the file specification of the open channel
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
xcall FILNM(channel, file_spec[, length])
Arguments
channel
The open channel. If the channel is not open, a “Channel has not been opened” error ($ERR_NOOPEN) is generated. (n)
file_spec
The variable that will be loaded with the file specification, left-justified over blanks. (See File specifications for a description of a file specification layout.) (a)
length
(optional) The length of the filename string. (n)
Discussion
The FILNM subroutine returns the file specification of the file that is currently open on a specified channel.
The information returned by the FILNM subroutine can clarify an I/O-oriented error when it is trapped by a program. The program can report the error number, use the ERTXT subroutine to provide a description of the error, and then call FILNM to report the specification of the file involved.
If file_spec is too short to hold the entire file specification, only the leftmost portion of the specification is returned.
The FILNM subroutine of a channel opened to TT: returns TT:.
Examples
subroutine proc_error a_chn ,d ;Optional .define TTCHN ,1 record msg ,a45 file ,a80 proc xcall ertxt(%ernum, msg) writes(TTCHN, "Error# + %string(%ernum) + ": " + msg + "at line " & + %string(%erlin)) if (^passed(a_chn)) begin xcall filnm(a_chn, file) writes(TTCHN, "File: + file(1:%trim(file))) end return endsubroutine