MIAMEX 161: Get File Channel Info

Added August 2015

xcall MIAMEX, MX_FILECHINFO, ch, status, fileinfo

MX_FILECHINFO (161) returns information about an open file based on the file channel. It is similar to FILNAM.SBR but provides much more information.

Parameters

ch  (Num)  [in]

file channel

status  (Num)  [out]

returns > 0 if the file channel was located, else 0

fileinfo  (ST_FILE_METADATA)  [out]

returns info about the file

ST_FILE_METADAT is defined in ASHINC:ashell.sdf as:

defstruct ST_FILE_METADATA   ! [103] File metadata returned by MX_FILECHINFO

map2 SPEC,s,160              ! file spec, as specified in OPEN

map2 TYPE,b,1                ! see FILETYPE_xxx

map2 DRIVER,b,1              ! internal implementation code (see FILEDVR_xxx)

map2 MODE,b,2                ! see FILEMODE_xxx

map2 HOOKID,b,4              ! file hook id

map2 HOOKFLAGS,b,4           ! file hook flags

map2 HOOKEVENTS,b,4          ! file hook events

map2 RANDOM'ISAM             ! fields for random and ISAM files

map3 RECSIZ,b,4           ! record size (according to open; true size for ISAM)

map3 BLKFCT,b,2           ! 0=spanblocks

map3 RECCNT,b,4           ! # records (does not apply to ISAM-A)

map3 ISAMA                ! ISAM-A only

map4 INDEX,b,2         ! selected index #

map4 ISFIND,i,2        ! result of last FIND # - see ISFIND_xxx  

map4 ISLOCK,b,4        ! current locked recno

map4 LASTRECNUM,b,4    ! last rec #

map2 SEQ                     ! fields for sequential files

map3 SPOS,f,8             ! stream pos (0=start, -1=eof)

map3 ISEQ                 ! input files only

map4 CSVDELIM,s,2      ! CSV delimiter

map3 OSEQ                 ! output files only

map4 OPOS,b,4          ! output column position

map4 LINENO,b,4        ! line # for cur pg - same as .LINENO(ch)

map4 PAGENO,B,4        ! page # - same as .PAGENO(ch)

endstruct

 

Comments

If you call the function in a version of A-Shell less than 6.1.1416, you may not get an error status, but the contents of the structure will be empty.

History

2015 August, A-Shell 6.1.1415:  Function added to A-Shell