Text file data can be in any of the two formats :
1. Fixed Record
Length or Fixed Width Files
2. Variable Record
Length or Delimited Files
Fixed Record Length or Fixed Width Files
In case of Fixed Record Length:
1. Size of each field
is fixed and values have to be for the entire size. If the value is smaller
than the size then some filler character(s) are used like: Zero, Spaces, etc.
For example:
1 INDIA ***********1000
2 CANADA *********2000
2. No field separator
(like comma) is used and no text Qualifier (like Single or Double Quotes) is
used.
3. Data from such
file are extracted based on the starting position of the Field and Size of the
field. For example:
COLUMN_NAME
|
POSITION
|
EMP_ID
|
Starting position 1 and size 3
|
EMP_NAME
|
Starting position 4 and size 15
|
SALARY
|
Starting position 19 and size 4
|
Variable Record Length or Delimited Files
In case of Variable Record Length
1. Size of the fields
is variable and they depend upon the actual size of the value.
2. Fields values are
separated by a Delimiter (like Comma, Pipe Delimiter) and values are enclosed
within Text qualifiers (like Single or Double Quotes). For example:
"1"|" INDIA "|"1000"
"2"|"
CANADA
"|"2000"
3. Values are
extracted based on the position of Delimiters (like Comma).
####Also read about "How to use Flat Files"
No comments:
Post a Comment