9.2.2.4 Using a Source Definition File
You can use fixed width parsing based on a data definition that comes from an Oracle GoldenGate source definition file. This is similar to Cobol copybook because a source definition file contains the position and the length of each field of participating tables. To use a source definition file, you must set the following properties:
fixed.userdefs.tables=qasource.HEADER
fixed.userdefs.qasource.HEADER.columns=optype,schemaandtable
fixed.userdefs.qasource.HEADER.optype=vchar 3
fixed.userdefs.qasource.HEADER.schemaandtable=vchar 30
fixed.header=qasource.HEADER
The following example defines a header section of a total length of 33 characters; the first 3 characters are the operation type, and the last 30 characters is the table name. The layout of all records to be parsed must start with the complete header section as defined in the fixed.userdefs
properties. For each record, the header section is immediately followed by the content of all column data for the corresponding table. The column data must be strictly laid out according to its offset and length defined in the source definition file. Specifically, the offset information is the fourth field (Fetch Offset) of the column definition and the length information is the third field (External Length) of the column definition. The following is an example of a definition for GG.JMSCAP_TCUSTMER:
Definition for table GG.JMSCAP_TCUSTMER
Record length: 78
Syskey: 0
Columns: 4
CUST_CODE 64 4 0 0 0 1 0 4 4 0 0 0 0 0 1 0 1 0
NAME 64 30 10 0 0 1 0 30 30 0 0 0 0 0 1 0 0 0
CITY 64 20 46 0 0 1 0 20 20 0 0 0 0 0 1 0 0 0
STATE 0 2 72 0 0 1 0 2 2 0 0 0 0 0 1 0 0 0
End of definition
The fixed width data for GG.JMSCAP_TCUSTMER may be similar to the following where the offset guides have been added to each section for clarity:
0 1 2 3 0 1 2 3 4 5 6 7 8
012345678901234567890123456789012012345678901234567890123456789012345678901234567890123456789012345678901234567890
I GG.JMSCAP_TCUSTMER WILL BG SOFTWARE CO. SEATTLE WA
I GG.JMSCAP_TCUSTMER JANE ROCKY FLYER INC. DENVER CO
I GG.JMSCAP_TCUSTMER DAVE DAVE'S PLANES INC. TALLAHASSEE FL
I GG.JMSCAP_TCUSTMER BILL BILL'S USED CARS DENVER CO
I GG.JMSCAP_TCUSTMER ANN ANN'S BOATS SEATTLE WA
U GG.JMSCAP_TCUSTMER ANN ANN'S BOATS NEW YORK NY
You can choose to specify shorter data records, which means that only some of the earlier columns are present. To do this, the following requirements must be met:
-
None of the missing or omitted columns are part of the key and
-
all columns that are present contain complete data according to their respective External Length information
.
Parent topic: Fixed Width Parsing