Author |
Message
|
wmbdaniel1 |
Posted: Fri May 30, 2014 2:13 am Post subject: CSV format |
|
|
Newbie
Joined: 20 May 2014 Posts: 6
|
Let me first begin with CSV format
I have 1 Header with 5 fields in it & 5 records with 15 fields.
I constructed a DFDL message model for the CSV file.
I have a scenario where i need to check for file Integrity in first flow.
File input----> Compute----> File output
File integrity flow checks for number of records in header and the actual records and it also checks for file size in header and the actual file size. Only if both of these are equal it sends to second flow otherwise throws an error.
The input file may be empty also.so for this i made header and record as 0 occurance.
The issue now is if i send a file with header and record now it is taking header also as record not as an header where by integrity check is also not done and throwing an error.
If we give header and record as an optional does it take header also as a record.
Could any1 throw some light |
|
Back to top |
|
 |
kimbert |
Posted: Fri May 30, 2014 3:32 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
|
Back to top |
|
 |
wmbdaniel1 |
Posted: Fri May 30, 2014 4:19 am Post subject: |
|
|
Newbie
Joined: 20 May 2014 Posts: 6
|
No Kimbert
Does a DFDL having 0 occurances in header and record level will take header as a record????
in my case its happening that the header is coming as record structure
IS it the default behaviour of FDDL??? |
|
Back to top |
|
 |
kimbert |
Posted: Fri May 30, 2014 5:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
You need to understand a little about how DFDL works. DFDL is a 'backtracking' parser. If it fails to parse 'Header' and Header is optional then it will assume that Header is not in the data. It will then back out of Header and try Record. Check the DFDL trace and you will see it all happening.
To answer your question, yes this is the default behaviour of DFDL. It is the only consistent behaviour that is possible if the DFDL model is completely unconstrained. Read on to find out how to put constraints into your model...
You know that a Header looks different from a Record. DFDL does not, unless you provide that information in your model. You need to
- work out what make a Header different from a Record
- add a DFDL discriminator to 'Header' so that the DFDL parser realizes that it is definitely parsing a Header. Once the discriminator expression evaluates to 'true' the DFDL parser will not back out of Header. Any errors after that will be treated as evidence that Header is badly-formed ( which is what you need ). _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
wmbdaniel1 |
Posted: Fri May 30, 2014 6:36 am Post subject: |
|
|
Newbie
Joined: 20 May 2014 Posts: 6
|
Thanks kimbert
Given lot of info  |
|
Back to top |
|
 |
|