FILEINFO()

FILEINFO()

Top  Previous  Next

 

The FILEINFO() function returns information about an open file.

 

 

Format

 

FILEINFO(file.var, key)

 

where

 

file.varis the file variable associated with the file.

 

keyidentifies the action to be performed.

 

 

Values for the key to the FILEINFO() function are defined in the KEYS.H record in the SYSCOM file. These are

 

0

FL$OPEN

Check if file is open. Returns True if file.var is associated with an open file, False if it is not.

1

FL$VOCNAME

Returns the VOC name used to open the file. For a file opened via QMNet, this is the server:account:file form of the file name.

2

FL$PATH

Returns pathname of open file.

3

FL$TYPE

File type. Returns one of

FL$TYPE.DH (3) - Dynamic file, including data collections

FL$TYPE.DIR (4) - Directory file

FL$TYPE.SEQ (5) - Sequential file

FL$TYPE.VFS (6) - Virtual file system

FL$TYPE.DIST (7) - Distributed file

5

FL$MODULUS

File modulus (dynamic files only)

6

FL$MINMOD

Minimum modulus (dynamic files only)

7

FL$GRPSIZE

Group size in multiples of 1024 bytes (dynamic files only)

8

FL$LARGEREC

Large record size (dynamic files only)

9

FL$MERGE

Merge load percentage (dynamic files only)

10

FL$SPLIT

Split load percentage (dynamic files only)

11

FL$LOAD

Current load percentage (dynamic files only)

13

FL$AK

File has AK indices (dynamic files only)

14

FL$LINE

Line to read or write next (sequential files only)

15

FL$PARTS

Field mark delimited list of part file numbers (distributed files)

1000

FL$LOADBYTES

Current load bytes (dynamic files only)

1001

FL$READONLY

Returns True is file is read-only

1002

FL$TRIGGER

Returns trigger function name, null if none

1003

FL$PHYSBYTES

Returns total size of file, excluding indices

1004

FL$VERSION

Internal file version (dynamic files only)

1005

FL$STATS.QUERY

Returns True if file statistics gathering is enabled

1006

FL$SEQPOS

File position (sequential files only)

1007

FL$TRG.MODES

Returns mode flags for trigger function

1008

FL$NOCASE

Returns True if the file uses case insensitive ids.

1009

FL$FILENO

Returns the internal file number for file.var. This may change each time the file is opened.

1011

FL$AKPATH

Returns the pathname of the alternate key index directory. This is a null string if the indices are in their default location.

1012

FL$ID

Returns the id of the last record read from the file. Used with a dynamic file that is configured for case insensitive record ids, this will return the actual id as stored in the file, which may differ in casing from that supplied in the associated READ statement.

1013

FL$STATUS

Returns a dynamic array as for the STATUS statement.

1014

FL$MARK.MAPPING

Returns True if mark mapping is enabled, False if not (directory files).

1015

FL$RECORD.COUNT

Returns a count of the number of records in the file (dynamic files only). This count may be incorrect if the file was not closed in the event of an abnormal process termination such as a system failure. The counter will be corrected by use of a select operation during which there were no updates to the file or by use of the QMFix utility. The value will be returned as -1 until the count is set or for non-dynamic files.

1016

FL$PRI.BYTES

Physical size of the primary subfile in bytes (dynamic files only). This figure will include space previously used by groups that have been discarded as the result of a merge operation.

1017

FL$OVF.BYTES

Physical size of the overflow subfile in bytes (dynamic files only). This figure will include space previously used by overflow blocks that are no longer active and are retained for future use.

1018

FL$NO.RESIZE

Is resizing inhibited on this file? See the description of dynamic files for more information.

1019

FL$UPDATE

Returns the file update counter. This counter, shared across all users of the file, is initially set to 1 when a file is first opened and is incremented by every write, delete or clear file operation. It can be used to detect whether a file has been updated by another process.

1020

FL$ENCRYPTED

Returns True if the file uses encryption, False otherwise.

1021

FL$WHO

Returns field mark delimited list of QM user numbers of users that have the file open. The process that executes the FILEINFO() function will not appear in this list if file.var is the only file variable referencing the file.

1022

FL$NETFILE

Returns True if this is a QMNet file, otherwise returns False.

1023

FL$SEQTYPE

Sequential file sub-type:

FL$SEQTYPE.PORT (1) - Serial port

FL$SEQTYPE.CHDEV (2) - Character device

FL$SEQTYPE.FIFO (3) - FIFO

FL$SEQTYPE.DRIVE (4) - Disk drive or other block device

1024

FL$REPLICATED

Returns a field mark delimited list of replication targets.

1025

FL$NOMAP

Returns True if this is a directory file with character translation of record ids suppressed.

1026

FL$ECS

Returns True if this is a hashed file created in ECS mode.

1027

FL$ECS.MAP.NAME

Returns the ECS map name associated with the file.

1028

FL$ENCODING

Returns the data encoding name for a directory file.

1029

FL$LAST.PART

Returns the part number returned by the last evaluation of the partitioning algorithm.

1030

FL$INDEX.SCAN

File supports index scanning operations (SETLEFT, SETRIGHT, SELECTLEFT, SELECTRIGHT). Primarily intended for detection of VFS handlers that do not provide this functionality.

1031

FL$SEQ.KEY

Returns the sequential record id associated with this file. Unless the value has been updated using FCONTROL(), this will be the id of the last record written using the CREATING.SEQKEY option of the WRITE statement.

1032

FL$NON.TXN

Opened with NON.TRANSACTIONAL option?

1033

FL$SYNC

Opened with SYNC option (hashed files only)?

1035

FL$COLLECTION

Returns True if the file is a data collection.

1036

FL$OWNER

Returns the owner of the file (Windows only)

1037

FL$TEMP

Returns true if file.var references a temporary file.

1038

FL$TXN.UPDATE

Returns True if file is updated in the current transaction.

1039

FL$LOCKS

Returns a field mark delimited list of locks owned by the current user in this file. Each entry is formed from two values; the lock type code and the record id.

 

 

Example

 

IF FILEINFO(FVAR, FL$TYPE) # FL$TYPE.DH THEN

  ABORT "Dynamic file required"

END

 

This program fragment checks whether a file variable is associated with a dynamic file and, if not, aborts.

 

 

See also:

STATUS