Import field from port

Command group Flag affected Reversible Execute on client Platform(s)
Importing and Exporting YES NO NO All

Syntax

Import field from port into field-name ([Single character][,Leave in buffer][,Clear buffer][,Do not wait])

Options

Single character If specified the command reads a single character at a time
Leave in buffer If specified, the command leaves the data it returns in the buffer meaning that the next call to the command will return the same value
Clear buffer If specified, the command clears the import buffer before executing
Do not wait If specified, the command will not wait until data is available

Description

This command reads a line of characters from the current port to the specified field. Import field from port lets you read fields from a port without using a window and Import data. Usually the command reads a whole line at a time but there are options which modify this:

Single character tells Omnis to read a single character at a time. If the field is a Character or a National field, it is set to have a length of one, containing the single character imported from the port. If the field is a Number field, the field value is set to the ASCII code of the single character imported from the port.

Leave in buffer tells Omnis to read the string or single character but not remove it from the buffer. Therefore, the next Import field from port command will read exactly the same value.

Clear buffer clears the import buffer so that previously received values are ignored.

Do not wait prevents Omnis from waiting until a string or character is available.

An error will occur if the import port has not been opened; Omnis clears the flag if nothing has been read. Do not mix the Import data and Import field from port commands because they use the input buffer in different ways.

Example

Set port name {COM1:}
Prepare for import from port {One field per line}
Repeat
  Import field from port int lImportField
Until lImportField='start dat
Do method ImportData
Close import file