(Contents)(Previous)(Next)

Selecting Records from the Source File

Records of a source file can be loaded into a table according to their contents:

Example 1:

DATALOAD TABLE reservation IF POS 13-22 >= '29.04.1997'

rno 1-4

cno 5-8

hno 9-12

arrival 13-22

departure 23-32

price 33-40

INFILE rmaster.data

DATE 'dd.mm.yyyy'

Example 2:

DATALOAD TABLE hotel

IF (POS 48-52 REAL < '1 000.00')

AND

(POS 48-52 REAL >= '100.00')

hno 01-04 INTEGER

name 09-18

city 20-39

state 40-41

zip 42-46 DECIMAL

price 48-52 REAL

INFILE hotel.data

The selection criterion begins with the keyword IF. One or more conditions follow. These can be negated (NOT), linked by AND and OR, and bracketed in any form. If no parentheses are used, the operators have the following precedence: NOT is stronger linking than AND and OR, AND is stronger linking than OR. Operators with the same precedence are evaluated from left to right.

Only those records that match the simple or composed condition are loaded.

Every simple condition begins with the keyword POS. This is followed by the position and, if necessary, by the data type of a value in the input record, the comparison operator, and a constant.

A comparison value in the input record is described, like the actual input fields, by its position and an optional format specification. The format of the file value must only be specified when it is not the default CHAR.

The constant must be enclosed in single quotation marks and be specified as a plaintext value. It will be converted in such a manner that it will have the same type as the file value.

If the defined condition compares two numerical values with each other, the constant must have a valid number format; that is, it must either be a floating point number in mantissa/exponent representation or a fixed point number in the currently determined or default decimal representation.

If the defined condition compares two character strings with each other, then constant and input field must have the same length.


(Contents)(Previous)(Next)