FPOSITA


9.1

The FPOSITA instruction retrieves the current AAM index position. It uses one of the following formats:

 

 

[label]

FPOSITA

{afile},{pos}

 

Where:

label

Optional. A Program Execution Label.

afile

Required. A previously defined and opened AFILE definition whose current index position is returned.

pos

Required. A previously defined Character String Variable that receives the current index position data.

Flags Affected: none

Note the following:

  1. All data stored in {pos} is required by the REPOSITA instruction to restore the AAM index position. This allows the READKG or READKGP instructions to be performed without having to execute a READ AAM with key instruction.

  2. The data stored in {pos} is composed of two basic sets of components. The first set of components is the basic parameters required to reset the AAM index position. The second set of components is the user key data strings that are in use for the AFILE when the FPOSITA instruction is executed. The size of the {pos} is determined by the size of the two sets of components. The size of the first set depends on the operating system where the runtime is being executed. The size of the second set of key data depends on the user application keys that are in use when the FPOSITA is executed.

    The size of {pos} can be calculated as follows:

    possize = indexsize + keysize1 + keysize2...+ keysizeN

    Where:

    indexsize
    The size of the AAM index data that is required to restore the AAM index position. This size depends on the OS where the runtime is executed (Windows runtimes - 24 bytes).

    keysize1
    The size of the first user key string plus one.

    keysize2
    This is the size of the second user key string plus one.

    keysizeN
    The size of the Nth user key string plus one.

    Example:

    The minimum size of AAMPOS is calculated as follows when using a Windows runtime and the key as shown:

    size = 24 + 7 = 31

  3. AMPOS

    DIM

    31

    AFILE

    AFILE

     

    KEY1

    INIT

    "01XABC"

    .

     

     

     

    OPEN

    AFILE...

    .

     

     

     

    READ

    AFILE,KEY1;S$CMDLIN

     

     

     

     

    FPOSITA

    AFILE,AAMPOS

     

  4. The FPOSITASIZE keyword of the GETFILE instruction returns the minimum size required for the {pos} based on the current key values.

  5. An I29 runtime error can occur during the execution of the FPOSITA instruction. Subcodes help identify the specific problem.

 

 

See Also: REPOSITA, Disk I/O Instructions

 



PL/B Language Reference FPOSIT FPOSITB