I’m trying to use a FFSchema to facilitate communication with an external message broker (non-webMethods) which provides services that take a fixed block as input, and pass a fixed block back as output.
End result is that I have to parse out these block structures into documents.
I made a quick attempt with FFSchemas, and it works great for flat structures, but now I’ve come across a situation where I want to pass a slightly more hierarchical structure. A quick example:
XXX1234ABABABCD
defined as
ID (4)
Age (4)
Code1 (2)
Code2 (2)
Usage (4)
In this simple case, I’ve got a three character field, a four character field, two two character fields, and a four character field. This is defined in the FFSchema, and everything works fine.
The problem comes in when I have a repeating sub-structure - I don’t know how to represent it… To use my shorthand from above:
ID (4)
Age (4)
50* (
-----VehicleID (10)
-----VehicleCapacity(5) )
Date (8)
The flatfile would look like:
XXXX1234CarNum0001Cap01CarNum0002Cap02…CarNum0050Cap5020031204
Any suggestions on how to approach this?
I’ve got no delimiters, and a single record basically.
I was having similar problem but the list of values (like the Vehicles in your example) was at the end of each record. Similarly the length of this list was any.
The trick that I did was that I considered the list as a single fixed position field with the end position of something huge like 99999999 or MAX_INT or any huge enough value. Then I passed this field to another schema to parse it and get the fields separately.
This trick worked because I had list of values at the end. In your case I can’t see it working, but maybe you could change the order in your file and place the list at the end?`
That’s a thought… I have the size of the subrecord, and the fixed number of occurences, I can parse it out in a two stage process by specifying the structure as a single field in the first stage.
For this example, I’d have to set the length to 50*15 or 750.
I had considered it, but thought that there might be a way to define it in the FFSchema itself. I’ll assume not though, and just go forward with the two stage development.
Thanks.
As far as I know the FFSchema does not support complex structures. There can be no hierarchies in the records. So either you can do it the way you say if you know that the number of elements is fixed. Or if you don’t know how many occurrences there would be the field needs to be at the end like in my case.