HELP: Row-spec auto-detection hints passed to ROWDET/DETFIX (all optional) TYPE: OBJECT SYNTAX: DETECT(MINREC=num,MAXREC=num/DEFAULT/FULL,MAXCOL=num,MAXROW=num,ROWOUT='str'/STREAM/DUMMY,REUSE,NOMATCH,NORANGE,REGEXP,COLCAP=num,TARGET=ALL/TEXT/CHAR/BINARY/XML/CSV/FIX,DISABLE=num/NONE/CSV/FIX/XML/ALL,SETCHR,HINTS(),FORMAT=NONE/IMSL/IMSS/IHDU/RDW/CSV/FIX/XML)
The DETECT sub-object passes optional hints to the ROWDET row-spec auto-detector. It is available inside any TABLE object parallel to COMPILE, and is also used directly by the ACSV command. All parameters are optional; omitting them enables full auto-detection with defaults.
DETECT itself carries flow-control parameters (sample sizing, output redirect, suppression switches). Type-detection HINTS -- charset, byte-order, BCD/INT/FLT/BIN family masks, default CCSIDs, null sentinel list -- live in the DETECT.HINTS sub-object so the top-level DETECT stays compact and the per-type filters can grow independently.
Auto-detection is a best-effort inference from the raw bytes; it is NOT guaranteed to reconstruct the original record layout. ROWDET can only place a column boundary where the data itself carries a distinguishing feature -- a type change, a separator, a constant filler, or a regular padding pattern. Where adjacent fields share the same physical type and no boundary marker, they merge into a single detected column.
Typical cases that cannot be split without a copybook (COMPILE):
ROWDET does exploit padding when it is present and constant across the analysed records: a constant leading-zero run marks the start of a zoned number, and a constant trailing-blank run marks the end of a text field, so multiple padded fields can be separated. This only works when the values stay narrower than the field width in every analysed record; if any record fills a field completely the padding signal disappears and the fields merge.
For a guaranteed-correct column structure, supply the record description via COMPILE (a COBOL/PL/I/assembler copybook or an explicit row-spec) instead of relying on DETECT.
MAXREC controls how many records are analysed before deciding on a layout:
MINREC controls how many of those records must agree on the same layout for the detected row-spec to be accepted as valid:
MAXREC and MINREC work together: MAXREC caps the CPU cost of analysis while MINREC sets the confidence threshold. A file with occasional header or trailer records of a different length is still detected correctly as long as the dominant layout appears in at least MINREC records.
Example: a file with 7 data records (fixlen=80) and 1 header record (fixlen=20) is correctly detected with the defaults MAXREC=8 MINREC=2, since 7 of the 8 analysed records share fixlen=80.
detect(MAXREC=16 MINREC=4) -- analyse up to 16 records, require 4 to agree
Unless DETECT.HINTS.CHRSET names one, the character set is detected from the data, and it matters twice over: it decides how a column's content is read, and for fixed-length records it also decides where the column BOUNDARIES are, because the detector separates text from non-text byte by byte.
The detection weighs the bytes that tell the character sets apart -- blanks, digits and letters -- and ignores the ones printable in both. Where the sample leaves no clear lead, the two record families answer differently, on purpose:
Name CHRSET explicitly whenever the data is known -- an explicit value is never overridden by either rule.
All charset, byte-order, family and CCSID hints live inside DETECT.HINTS.
The HINTS sub-object groups its content into per-type sub-sub-objects
DATE / INT / FLT / BIN / STR plus three cross-type scalars LOCALE /
CHRSET / ENDIAN and the shared NULLST list. See the
detect.hints manual page for the full per-type catalogue.
Cross-type scalars (HINTS.LOCALE / HINTS.CHRSET / HINTS.ENDIAN / HINTS.NULLST):
detect(hints(chrset=EBCDIC endian=BIG locale=DE))
Per-type filters (HINTS.INT / HINTS.FLT / HINTS.BIN / HINTS.STR / HINTS.DATE):
detect(hints(chrset=EBCDIC endian=BIG int(bcd=PACKED width=I32) flt(family=HFP))) detect(hints(chrset=ASCII str(defasc='ISO-8859-15'))) detect(hints(int(fradig=2 bcd=PACKED))) -- 2 decimal places on detected BCD
# TABLE object with DETECT hints inside flcl conv: read.bin(reclen=80 table(detect(hints(endian=BIG int(bcd=PACKED) flt(family=HFP))))) # ACSV: EBCDIC z/OS data with German code page IBM-1141: flacsv INPUT=cobol_unload.bin OUTPUT=out.zip DETECT(HINTS(CHRSET=EBCDIC ENDIAN=BIG INT(BCD=PACKED) FLT(FAMILY=HFP) STR(DEFEBC='IBM-1141'))) # ACSV: EBCDIC with platform default CCSID (FL_DEFAULT_EBCDIC_CCSID): flacsv INPUT=cobol_unload.bin OUTPUT=out.zip DETECT(HINTS(CHRSET=EBCDIC ENDIAN=BIG INT(BCD=PACKED) FLT(FAMILY=HFP))) # Linux C struct dump (LE floats, ASCII data, Western European strings): flacsv INPUT=c_dump.bin OUTPUT=out.zip DETECT(HINTS(CHRSET=ASCII ENDIAN=LITTLE INT(BCD=NONE) FLT(FAMILY=IEEE) STR(DEFASC='ISO-8859-15')))
REUSE controls what happens when the format of incoming records changes mid-stream and all currently active row-specs fail to parse a record. This situation arises when binary files contain multiple logically distinct sections with different layouts.
In both modes an infinite-loop guard aborts re-detection if no record was successfully processed since the previous ROWDET call.
ROWOUT writes the row-spec(s) detected by ROWDET to the specified file. The file contains one row() object per detected row-spec:
row(name='DETECTED' fixlen=20 col(name='COL0001' ...) col(name='COL0002' ...))
This output can be passed to flbcsv ROWIN= or used inside a TABLE object as a validated schema for repeated production processing.
flacsv INPUT=unknown.bin OUTPUT=result.zip DETECT(ROWOUT=inferred.tab) flbcsv INPUT=unknown.bin OUTPUT=prod.zip ROWIN=inferred.tab
SETCHR controls whether the detected character set is emitted as a format.str(chrset=...) annotation in the column specifications produced by CSV detection.
When SETCHR=ON the detected charset (ASCII or EBCDIC) is included in every type.string, type.integer, type.float, and type.date column spec that uses format.str():
col(name='COL0001' type.string(format.str(chrset=ASCII))) col(name='COL0002' type.integer(format.str(chrset=EBCDIC)))
When SETCHR=OFF (the default) the charset annotation is omitted and the column converter uses the row-level charset from the enclosing row-spec. Use SETCHR=ON when the ROWOUT file will be consumed in a context where the row-level charset is not available.
flacsv INPUT=mixed.bin OUTPUT=result.zip DETECT(SETCHR=ON ROWOUT=spec.tab)
DETECT.HINTS.NULLST sets the comma-separated null sentinel list applied to all type detectors. Empty values, NULL, NA, NaN and locale-specific synonyms are mapped to EMPTID by the per-type detectors so a column with sporadic "N/A" entries still classifies as INT or DATE rather than degrading to STRING.
A '+'-prefix appends the user-supplied list to the system default (see DEFAULTS.NULLST for the default list); without the prefix the user list replaces the default.
detect(hints(nullst="+TBD,-")) -- accept defaults plus "TBD" and "-" detect(hints(nullst="MISSING")) -- only "MISSING" is treated as null
NUMBER: MINREC=num - Min records that must agree on layout to accept a row-spec [DEFAULT=2]NUMBER: MAXREC=num/DEFAULT/FULL - Max records to analyse: DEFAULT(0)=8, FULL(1)=whole block, 2..n=exact count [DEFAULT]
DEFAULT - Use default max records (8) [default]FULL - Use all complete records in the first input blockNUMBER: MAXCOL=num - Maximum columns per detected row-spec; exceeding returns NFR [1000]NUMBER: MAXROW=num - Maximum rows in isDetect accumulation table (REUSE=ON); exceeding disables re-detection [16]STRING: ROWOUT='str'/STREAM/DUMMY - Write detected TABLE string to this file for use with flbcsv ROWIN= [none]
STREAM - Read from stdin or write to stdoutDUMMY - Read EOF or write nothingSWITCH: REUSE - Reuse previously detected row-specs on format change; default OFF always re-detects [OFF]SWITCH: NOMATCH - Suppress Bootstrap-Discriminator MATCH predicates on filler zones [FALSE]SWITCH: NORANGE - Suppress Bootstrap-Discriminator max+r2ferr on binary-integer zones [FALSE]SWITCH: REGEXP - Emit character-class regexp constraints on string zones (G5, experimental) [FALSE]NUMBER: COLCAP=num - Cap filler-zone match annots when col count >= cap; prevents CLP OOM on wide files [0=disabled]NUMBER: TARGET=ALL/TEXT/CHAR/BINARY/XML/CSV/FIX - Restrict ROWDET to TEXT, CHAR, BINARY or XML sub-detectors [ALL]
ALL - Probe all detectors in priority order [default]TEXT - Text-only detectors: DETCSV, JSONDETCHAR - Character-mixed: DETCSV(CHAR), JSONDET(CHAR)BINARY - Binary-only detectors: DETFIX, VARDETXML - XML detector (stub until DETXML is implemented)CSV - Force CSV detector only (DETCSV); bypasses canDetect() gatesFIX - Force FIX detector only (DETFIX); bypasses canDetect() gatesNUMBER: DISABLE=num/NONE/CSV/FIX/XML/ALL - Disable specific ROWDET sub-detectors: CSV, FIX, XML or bitmask; NONE=all active [NONE]
NONE - All sub-detectors active [default]CSV - Disable DETCSV (text separator detection)FIX - Disable DETFIX (binary fixed-layout detection)XML - Disable DETXML (XML structure detection)ALL - Disable all ROWDET sub-detectorsSWITCH: SETCHR - Emit detected charset in format.str() specs (type.date/integer/float); OFF=auto-detect per row [OFF]NUMBER: FORMAT=NONE/IMSL/IMSS/IHDU/RDW/CSV/FIX/XML - VB/IMS format hint: NONE=auto, IMSL/IMSS/IHDU/RDW=explicit [NONE]
NONE - Auto-detect: ROWDET probes VB/IMS markers; falls through to CSV/FIX/XML if none found [default]IMSL - IMS DFSURGU0 LONG: 4B RDW + 20B prefix, RECFM=VB, SEGNAM discriminatorIMSS - IMS DFSURGU0 SHORT: 4B RDW + 4B prefix (LL+ZZ); use this hint -- EOF sentinel (inner LL=4) rarely in first block, so auto-detect is unreliableIHDU - IMS HD Unload DFSURGL0: 4B RDW + 36B prefix, 2-byte SEG-CODE integer discriminatorRDW - Plain VB: 4B RDW only (LL+ZZ), no IMS prefix; length-based row groupingCSV - Force CSV sub-detector; skip DETFIX and DETXMLFIX - Force DETFIX sub-detector; skip DETCSV and DETXMLXML - Force XML sub-detector; skip DETCSV and DETFIX