FPOSIT


8.2E, ANSI

 

The FPOSIT instruction retrieves the current position of the file pointer. It uses one of the following formats:

 

(1)

[label]

FPOSIT

{file},{sector},{tab}

(2)

[label]

FPOSIT

{file},{offset}

 

Where:

label

Optional. A Program Execution Label.

file

Required. A previously defined and opened FILE, IFILE, or AFILE variable whose current position is returned.

sector

Required. A previously defined Numeric Variable in which the current position sector number is returned.

tab

Required. A previously defined Numeric Variable in which the current byte position within the sector is returned.

offset

Required. A previously defined Numeric Variable in which the current byte position from the beginning of the file is returned.

Flags Affected: OVER, ZERO

Note the following:

  1. Format one (1) returns the current sector in {sector} and byte position within the sector in {tab} (compatible with Datapoint's DOS method). The sector number is based upon the defined sector size for the file when it was last opened.

  2. Format two (2) returns the current byte position in {offset}. The result of this format is compatible with the REPOSIT instruction.

  3. The current file position remains unchanged.

  4. If the file position is zero, the ZERO condition flag is set.

  5. If any variable is not large enough to hold the appropriate position, the result is indeterminate and the OVER condition flag is set.

  6. If the environment variable PLBCMP_FPOSIT=RMS is present in the User Environment Table when a program is compiled with a 'FPOSIT FILE,OFFSET' type FPOSIT instruction, the compiler generates code that returns the byte position of the beginning of the record. If the environment variable is not present when the program is compiled, the FPOSIT instruction generates code that returns the byte position of the next byte in the record.

  7. When using SQLIO, the position returned for the record position is one less than the sun_recno field of the current row in the application data table.

 

 

See Also: Example Code, FPOSITB, FPOSITC, REPOSIT, Disk I/O Instructions

 



PL/B Language Reference FLUSHEOF FPOSITA