DETECT

Synopsis

HELP:   Auto-detect element type from data; detection hints optional [none]
TYPE:   OBJECT
SYNTAX: DETECT(LOCALE=AUTO/ISO/DE/US/ANSI/FR/CH,HINTS(LOCALE=AUTO/ISO/DE/US/ANSI/FR/CH,CHRSET=AUTO/ASCII/EBCDIC,ENDIAN=SYSTEM/BIG/LITTLE/LOCAL,NULLST='str',DATE(YEARMIN=num,YEARMAX=num,PIVOT=num,LOCALE=AUTO/ISO/DE/US/ANSI/FR/CH,EPOCHBASE=AUTO/UNIX/LILIAN/J2000/EXCEL),INT(LOCALE=AUTO/ISO/DE/US/ANSI/FR/CH,SIGNCONV=AUTO/LEADING/TRAILING/ZONED/NONE,WIDTH=ALL/NONE/I16/I32/I64,BCD=ALL/NONE/ZONED/PACKED,FRADIG=num),FLT(LOCALE=AUTO/ISO/DE/US/ANSI/FR/CH,NOINFNAN,NOSCI,FAMILY=ALL/NONE/HFP/IEEE/DFP,FRASEP=SYSTEM/PERIOD/COMMA/APOSTROPHE,GRPSEP=NON/OFF/SYSTEM/PERIOD/COMMA/SPACE/APOSTROPHE,FRADIG=num),BIN(BASEPREF=AUTO/BASE16/BASE32/BASE64,BASE=num/ALL/NONE/HEX/BASE32/BASE64),STR(POLICY=AUTO/STRICT_ASCII/ALLOW_UTF8/ALLOW_CTRL,DEFASC='str'/DEFAULT/ASCII/EBCDIC/BOMUTF/BOMUCS/SYSTEM/LOCAL,DEFEBC='str'/DEFAULT/ASCII/EBCDIC/BOMUTF/BOMUCS/SYSTEM/LOCAL)))

Description

The type.detect() element type instructs the column converter to probe each field value at runtime and select the best-fit type automatically. It replaces a static type annotation (type.string, type.integer, etc.) with a one-pass detector that picks from integer, float, date, and string depending on what the data actually contains.

type.detect() is valid wherever a column type annotation is expected inside a row() spec, and as the top-level DETECT object on commands that support whole-table auto-typing (flbcsv DETECT, TABLE.DETECT).

When used on a single column the detector evaluates only that column's values; when used at command level it applies to every string column (PIC X/A/CHAR/CL) in the schema that does not already carry an explicit type annotation.

Parameters

LOCALE -- locale override for all per-type detectors within this column [AUTO]. Affects date-pattern matching and decimal-separator recognition. Available values: AUTO / ISO / DE / US / ANSI / FR / CH.

HINTS -- per-type detection hints sub-object; groups every fine-grained filter for the date, integer, float, binary, and string detectors. All hints are optional. See the detect.hints manual page for the full catalogue.

Detection priority

When multiple type families could describe the same value, the detector applies this fixed priority order (highest first):

date > float > integer > binary > string

A value accepted by the date detector is never classified as integer even if it could be parsed as one. String is the unconditional fallback.

Column-level example

col(name='Amount' type.detect(locale=DE hints(int(fradig=2 bcd=NONE)))) col(name='EventDt' type.detect(hints(date(locale=ISO yearmin=2000)))) col(name='Flag' type.detect())

Command-level example (flbcsv)

flbcsv INPUT=payroll.bin FORMAT=payroll.cpy OUTPUT=out.zip DETECT() flbcsv INPUT=payroll.bin FORMAT=payroll.cpy OUTPUT=out.zip DETECT(LOCALE=DE HINTS(CHRSET=EBCDIC ENDIAN=BIG INT(BCD=PACKED)))

Arguments