Problem using positional flat file
NOTE: SCHEMA STRUCTURE AND FILE SAMPLES ARE GIVEN BELOW
Hello,
I am facing a strange problem while defining schema for following positional flat file...
Here the problem information goes:
1. Each line in the file is (CR-LF separated) and has a record type(20,40,50 etc) as mentioned below.
2. Numbers in the left of the file sample below, indicate the TAG IDNTIFIERS(01,10,20,40,50..90) used to identify each line type(Record type). (E.g. 20 is main transactional record, 50 is comment record and so on)
3. This file is organised into recurring groups and each group contains record type of 20(Mandatory) and 40,50,60 (Optional)
4. Record types 20 may be 1..n between a single group.
5. In some cases, if required, a 20 type record is followed by 0..n records of type 40,50 or 60.
6. Thus a single Business Record is formed by 20 (Mandatory) and any of 40,50,60 (0..n) [Optional]. Typical samples would be
Business Record 1: 20,
Business Record 2: 20,40
Business Record 3: 20,40,50
Business Record 4: 20,60
Business Record 5: 20,50
Business Record 6: 20,50,60
etc...
I am facing the problem to identify the records of type comment( 40,50,60 ) after I read 20s.
If file contains all records of type 20 ( In place of 40,50,60) then it goes smooth otherwise a sngle instance of any of 40,50,60 among 20 in a single group fails....
Can anyone please give me some clue on what is going wrong?
Present schema structure is :
Root
--File Header(Only 1 instance)
----Groups(1..n instances)
------Group Header(Only 1 instance)
--------Business records(1..n instances)
----------Business Record(Only 1 instance)
----------Comment Record 1(0..n instances)
----------Comment Record 2(0..n instances)
----------Comment Record 3(0..n instances)
--------Business records
------Group Trailer
----Groups
--File Trailer
File Sample:
01<<POSITIONAL RECORD>> - File Header
10<<POSITIONAL RECORD>> - Group Header , Group "A1" Starts here
20<<TRANSACTIONAL POSITIONAL RECORD>> - Main record
50<<COMMENT POSITIONAL RECORD TYPE 1>> - Comment record type 1
20<<TRANSACTIONAL POSITIONAL RECORD>> - Main record
50<<COMMENT POSITIONAL RECORD TYPE 1>> - Comment record type 1
20
50
20
20
20
40<<COMMENT POSITIONAL RECORD TYPE 2>> - Comment record type 2
20
20
20
50
20
20
20
50
20
90<<POSITIONAL RECORD>> - Group Trailer , Group "A1" ends here
10<<POSITIONAL RECORD>> - Group Header , New Group "A2" Starts here
20
20
20
20
60<<COMMENT POSITIONAL RECORD TYPE 3>> - Comment record type 3
20
50
20
50
20
20
60<<COMMENT POSITIONAL RECORD TYPE 3>> - Comment record type 3
60<<COMMENT POSITIONAL RECORD TYPE 3>> - Comment record type 3
20
20
20
90<<POSITIONAL RECORD>> - Group Trailer , Group "A2" ends here
.
.
.
.
. Multiple groups of Type "A" go here
.
.
.
99<<POSITIONAL RECORD>> - File Trailer
|