FILE Structure Properties

Top  Previous  Next

 

The following is a short list of properties that are particularly targeted to the components of a FILE structure. See also Runtime FILE and VIEW Properties for a more comprehensive list.

 

Multi-File Properties

 

 

File Properties

 

 

Key Properties

 

The following properties are all elements of a FILE data structure. They describe the attributes, fields, keys, memos, and blobs that may occur within a FILE structure. All these FILE structure properties are READ ONLY except: PROP:NAME (which can be used to change the name of a field in a file), PROP:OWNER, and PROP:DriverString. Assigning values to these properties overrides any values in the relevant declared attributes

Some properties are specific to the FILE and take the label of the FILE structure as the target, others are specific to a KEY (or INDEX) and take the label of the KEY (or INDEX) as the target, and others are specific to a BLOB and take the label of the BLOB as the target. Several properties are arrays, which take the number of the specific field or key as their element number to identify which field or key to return.

Each field that appears within the RECORD structure receives a positve number. In the RECORD structure, field declarations begin with 1 and increment by 1 for each subsequent field, in the order in which they appear within the RECORD structure. Terminating END statements for GROUP structures are not numbered, as they are not a field declaration.

MEMO and BLOB fields are numbered negatively. MEMO and BLOB declarations begin with -1 and decrement by 1 for each subsequent MEMO and BLOB, in the order in which they appear within the FILE structure.

See Also: File Structure Properties Example Program

Multi-Use File Structure Properties

PROP:Label

Returns the label of a declaration statement.

 

When no array element number is specified and the target is the label of a KEY (or INDEX), PROP:Label returns the label of the KEY (or INDEX).

 

When a positive array element number is specified and the target is a FILE, PROP:Label returns the label of the specified field within the RECORD structure.

 

When a negative array element number is specified and the target is a FILE, PROP:Label returns the label of the specified MEMO within the FILE structure.

 

When a positive array element number is specified and the target is a BLOB, PROP:Label returns the label of the specified BLOB.

PROP:NAME

The NAME attribute of the declaration statement.

 

When no array element number is specified and the target is the label of a FILE, PROP:Name returns the contents of the FILE statement's NAME attribute.

 

When a positive array element number is specified and the target is the label of a FILE, PROP:Name returns the NAME attribute of the specified field within the RECORD structure.

 

When a negative array element number is specified and the target is the label of a FILE, PROP:Name returns the NAME attribute of the specified MEMO or BLOB within the FILE structure.

 

When no array element number is specified and the target is the label of a KEY (or INDEX), PROP:Name returns the NAME attribute of the specified KEY (or INDEX).

PROP:Size

An array that returns the declared size of the specified MEMO, STRING, CSTRING, PSTRING, DECIMAL, or PDECIMAL field. The array index is the index of the field within the record structure.

file{PROP:Size, 1}  !returns the size of the first field in the file.

file{PROP:Size, -1} !returns the size of the first MEMO.

PROP:Type

The data type of the declaration statement.

 

When no array element number is specified and the target is the label of a KEY (or INDEX), PROP:Type returns either "KEY" or "INDEX."

 

When a positive array element number is specified and the target is the label of a FILE, PROP:Type returns a STRING that identifies the data type of the specified field within the RECORD structure.

PROP:Type now returns the type of the MEMO or BLOB. When a negative array element number is specified and the target is the label of a FILE, PROP:Type returns either "MEMO" or "BLOB"

FILE Statement Properties

These properties all take the label of a FILE as their target.

PROP:BLOB

Used with all database drivers that support the creation of BLOB columns:

 

blobRef &= file{PROP:Blob, N}

 

where N references the Blob Number to allocate (where a file may have multiple BLOBs)

 

This property is used to get a reference to a BLOB. N can be positive or negative. This will return a reference to the ABS(N)'th blob. Where N is the n'th memo or

blob. If N is a memo, NULL is returned.

 

Example:

AFile FILE,DRIVER('TOPSPEED'),PRE(EMP)

M1 MEMO

B1 BLOB

RECORD

..

ABlob &BLOB

CODE

ABlob &= AFile{PROP:Blob, 1} !Returns NULL

ABlob &= AFile{PROP:Blob, -1}!Returns NULL

ABlob &= AFile{PROP:Blob, 2} !ABlob is a reference to AFile.B1

ABlob &= AFile{PROP:Blob, -2}!ABlob is a reference to AFile.B1

PROP:Blobs

Returns the number of BLOB fields in the FILE structure.

PROP:CREATE

The CREATE attribute on the FILE statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:DRIVER

The DRIVER attribute. Returns the file driver of the FILE.

 

PROP:DriverString

A FILE property that returns the second parameter of the DRIVER() attribute of a file.

PROP:ENCRYPT

The ENCRYPT attribute on the FILE statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:FileDriver

Valid if you have the Dynamic File Driver system installed. You can now dynamically change the file driver of a statically defined file driver using

filelabel{PROP:FileDriver} = ADDRESS(OtherFile).

A file with the THREAD attribute will need to have its driver changed every time a thread comes into existence.

PROP:Key

An array that returns a reference to the specified KEY or INDEX in the FILE structure. This reference can be used as the source side of a reference assignment statement.

PROP:Keys

Returns the number of KEY and INDEX declarations in the FILE structure.

PROP:Memos

Returns the number of MEMO fields in the FILE structure.

PROP:OWNER

The OWNER attribute on the FILE statement.

PROP:OEM

The OEM attribute on the FILE statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

Prop:PRE

A Write-Only property for use in the dynamic file system to let you set the prefix of a dynamic file. This makes it easier to create duplicates of existing files without having to put the prefix in the name of all the components of the file.

PROP:RECLAIM

The RECLAIM attribute on the FILE statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:THREAD

The THREAD attribute on the FILE statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

 

Key Properties

These properties all take the label of a KEY (or INDEX) as their target.

PROP:Ascending

An array that returns '1' if the specified key component is in ascending order, and a null string ('') if in descending order.

PROP:Components

Returns the number of component fields of a KEY or INDEX.

PROP:DUP

The DUP attribute on the KEY statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:Field

An array that returns the field number (within the RECORD structure) of the specified component field of a KEY or INDEX. This field number can be used as the array element number for PROP:Label or PROP:Name.

PROP:NOCASE

The NOCASE attribute on the KEY or INDEX statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:OPT

The OPT attribute on the KEY or INDEX statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:PRIMARY

The PRIMARY attribute on the KEY statement. A toggle attribute which contains a null string ('') if absent, and '1' if present.

Field Properties

The following properties all take the label of a FILE as their target.

PROP:BINARY

The BINARY attribute on the MEMO or BLOB statement in the FILE structure. A toggle attribute which contains a null string ('') if absent, and '1' if present.

PROP:Dim

An array property of a file that returns the product of the array dimensions specified in the DIM attribute of the specified field. For example, for a field DIM(3,2) PROP:Dim returns 6.

PROP:Fields

There are several forms of the PROP:Fields property:

 

keylabel{PROP:Fields}

Returns the number of fields in the key definition

 

filelabel{PROP:Fields}

Returns the number of fields declared in the RECORD structure.

 

filelabel{PROP:Fields, n}

Returns the number of fields in the group. The value of this property is only defined if file{PROP:Type, n} returns 'GROUP'.

 

viewlabel{PROP:Fields}

Returns the number of fields declared in a VIEW.

 

viewlabel{PROP:Fields, n}

Returns the number of fields projected for the n file. If n is 0 then the total number of projects in the view is returned.

 

Example:

 

v VIEW(PFile),ORDER('PFile:String1'),FILTER('PFile:ID = 3')

  PROJECT(PFile:ID, PFile:String1)

   JOIN(Child1:Keyname, PFile:ID)         !File Child1 has 4 fields

    JOIN(Child2:Keyname, Child1:ID)       !File Child2 has 4 fields

     JOIN(Child3, 'Child3:LinkField = Child2:ID')

      PROJECT(Child3:String2)

     END

    END

    JOIN(Child2Child1:KeyName, Child1:ID) !File Child2Child1 has 4 fields

   END

  END

 END

 

 

v{PROP:Fields, 0} will return 15

v{PROP:Fields, 1} will return 2

v{PROP:Fields, 2} will return 4

v{PROP:Fields, 3} will return 4

v{PROP:Fields, 4} will return 1

v{PROP:Fields, 5} will return 4

See also: JOIN

PROP:Over

An array property of a file that returns the field number of the field referenced in the OVER attribute on the specified field.