IB Statements/position

From CometWiki

Jump to: navigation, search

POSITION statement

Syntax: POSITION (lun) KEY=argument [,EXCP=statement label | NOEXCP]

Discussion: The POSITION statement moves the file pointer to a specified key. If the specified key is not found, the file pointer is moved to the next higher key in ascending ASCII order. The lun must be opened to a keyed file. The KEY argument may be a string constant or string variable.

The file pointer will be positioned to the specified key or to the next higher record if the key is not found.

This statement does not result in runtime exceptions. For example, an exception 32 is not returned if the specified key is not found. Likewise, an exception 2 is not returned if the specified key is beyond the ASCII range of the keys in the file.

Example: POSITION (1) KEY=CUSTNO$, EXCP=9999

Personal tools