IFILE


ANSI

 

The IFILE and RIFILE instructions define an index sequential file. These files may be read by index keys directly, as well as sequentially forward and backwards. Individual records may be read, written, updated (in place) or deleted by a particular index key. IFILEs and RIFILEs may be read sequentially and randomly. Their definition uses one of the following formats:

 

(1)

[label]

IFILE

[%][*][({arraysize},...{arraysize})][{parm}]

(2)

[label]

RIFILE

[*][{parm}]

(3)

[label]

IFILE

^[,{label}]

(4)

[label]

IFILE

^({arraysize},...{arraysize})[,({target}),...,({target})]

(5)

[label]

IFILE

%%

 

Where:

label

Optional. A Program Execution Label.

%

Optional. Denotes the item as being GLOBAL.

*

Optional. Denotes the item as being COMMON.

arraysize

Optional. An Integer decimal constant, CONST variable or equated value indicating the number of array items.

target

Optional. A previously declared IFILE variable that initializes the array.

parm

Optional. One of the valid parameters listed below.

^

Optional. Denotes the item as being a POINTER.

label

Optional. The name of a previously defined data item of the same type.

%%

Optional. Denotes the item as GLOBAL but does not initialize it in any way.

Flags Affected: NONE

Note the following:

  1. An IFILE/RIFILE label must have been defined with a File Definition instruction before being referenced in an instruction. An RIFILE is treated as an IFILE by any instruction.

  2. IFILE/RIFILE definitions reference two physical files on the system. These files perform particular functions within the ISAM implementation as follows:

  3.  

    Type

    Use

    TXT

    The data file containing all of the text records for this IFILE/RIFILE.

    ISI

    The index to the records in the TXT file. It also monitors deleted record space for re-use, when appropriate and contains the TXT file name and path.

 

  1. {parm} is optional. The supported parameters are:

  2. BUFFER={nnnn | nvar | exp}

    This parameter establishes a maximum record length (not including the EOR character(s)) of {nnnn} bytes, the value of the previously defined numeric variable {nvar}, or the value of a numeric expression {exp}. In addition (unless the COMPRESSED option is given), the records in the file are fixed length and are not space compressed. Any short records written to the file are padded with blanks to the record length. The maximum allowed value is 65533.

    COMP or COMPRESSED

    This parameter allows space compressed and of variable length records within the file. The VAR parameter is assumed in this case. Space compression is performed using the operating system standards.

    DUP or DUPLICATES

    This parameter permits records with duplicate keys in the file. This is the default setting.

    DYNAMIC

    This parameter provides compatibility with other compilers and is simply ignored.

    FIX={nnnn | nvar | exp} or FIXED={nnnn | nvar | exp}

    See 'BUFFER=nnnn' above.

    FORMAT={MSDOS | UNX | BINARY}

    This parameter sets the end of record indicator within the file. The MSDOS type terminates records with a carriage return followed by a line feed for an end of record mark. The UNX type terminates records with a single line feed. The BINARY type does no checking on the file for the end of record type.

    NAME={value}

    This parameter specifies the actual disk name of the file. The parameter is only valid if used in conjunction with a FILELIST variable. {value} may be a literal or character string variable.

    NODUP or NODUPLICATES

    This parameter disallows records with duplicate keys in the file. If an attempt is made to write a duplicate key, an I/O error occurs.

    NOPATH

    This parameter prevents the storage of the data file's path in the index header. This is the same as creating the index file with the Z option.

    UNCOMP or UNCOMPRESSED

    This parameter does not permit space compressed records unless the VAR parameter is also present.

    UPPER or UPPERCASE

    This parameter treats all key data as upper case. When an I/O instruction occurs, the key information given is converted to upper case. The actual data written to the TEXT file is not modified.

    VAR={nnnn | nvar | exp} or VARIABLE={nnnn | nvar | exp}

    This parameter allows variable length records with a maximum length (actual data elements) of {nnnn} bytes, the value of the previously defined numeric variable {nvar}, or the value of a numeric expression {exp}. The maximum allowed value is 65533.

    VIEW={viewname}

    This parameter specifies a default view used for the file variable. The {viewname} can be a literal or a character string variable that specifies a database and view name.

    WEOF

    This parameter forces output of all write operations at the End Of File. Deleted record space is not reused. This option is assumed if the COMP or VAR parameters are given. The WEOF parameter may result in faster I/0.
     
  3. Additional parameters supported when using Datapoint Corporation's RMS Remote Access Server (RMSRAS) are as follows:

  4. FORMAT={BINARY | BIT8 | RMS | RMSUNCOMP}

    This parameter allows definition of the file type as specified.

    INCREMENT={nn}

    This parameter defines the file increment value.

    ISAMBUFFS={nn}

    This parameter specifies the number of index buffers.

    KEYLENGTH={nn}

    This parameter specifies the index key length.

    LENGTH={nn}

    This parameter specifies the record length.

    STATIC={nn}

    This parameter defines the number of buffers allocated to the file. It is provided for compatibility only and is ignored by the runtime.
     
  5. Where applicable, more than one option may be specified, such as:

  6. BUFFER and COMPRESSED

    FIXED and WEOF

    BUFFER, NODUP and UPPERCASE

     

  7. If the operand field begins with an asterisk (*), the file is a Common Data Item. An attempt is made to maintain the OPEN status (with existing file pointers intact) of a corresponding file declaration in the program that initiated the chain. However, if the UDA of the chained to program is not in alignment (same File Definition types, sizes, and locations) with those in the program that initiated the CHAIN, a CHAIN error occurs.

  8. Most parameters specified on the IFILE definition are overridden at execution by the actual characteristics of the file. The exception to this rule is the actual (maximum if variable length or space compressed records) record length specified with BUFFER, FIXED or VARIABLE parameters.

  9. Care should be used if performing UPDATEs against variable length or space compressed records. UPDATEs are not recommended with space compressed data files.

  10. When an ISAM or AAM file is created with variable length or space compressed records, all secondary ISIs and AAMs should be created with the same characteristics.

  11. The ^ denotes a Pointer Variable.

  12. If the % form is used, the data item is placed in the Global Data Area. The variable would be available to other programs that also declared it with the percent form. Global Data Items are available with PLBCMP only.

  13. If the %% form is used, the data label is placed in the Global Data Area but no initialization takes place if it has not already been defined in the Global Data Area. Global Data Items are available with PLBCMP only.

  14. Array definition and referencing is handled in the same manner as DIM variables.

  15. An IFILE array variable may be declared within a FILELIST/FILELISTEND declaration.

 

 

See Also: Example Code, File Definition, Disk I/O Instructions

 



PL/B Language Reference FILELIST PFILE