Urgent fixed length ff schema question

Hi,
I have a requirement to generate an outbound flat file with following requirements:

  1. fixed record size, say 20 for each record.
  2. for each record, from field1 to field3 only can be repeated 1 time with total fixed length 10.
  3. from field4 to field5, total length is 2 but can be repeated up to 5 times. Blanks will be fullfilled for un-repeated spaces.
    For example, I need two records in file:
    f1f2f3f4f5f4fSSSSSSSSSS\n
    f1f2f3f4f5SSSSSSSSSSSS\n
    f1f2f3f4f5f4f5f4f5ssSSSS\n
    How do I create a schema to cover this structure?
    I am using separate schemas to handle f1f2f3 and repeating f4f5 then concat two string together. (sounds kind stupid…)

Thanks,
Kevin

Kevin,

Fields cannot be repeated only RecordDefinitions can be repeated in the FlatFileSchema.

And looks like you flatfile requirement is delimited(newline or carriagereturn) and aswell fixedlength flatfile.

If i understood your comments correctly,So may be ur approach of concatenating two flatfile strings at the end is the approach.

HTH,
RMG

Hi RMG,

If you also say so, I believe concatenating two string will be my
final approach.

Best Regards,
Kevin

RMG,

Let me re-open this thread, so I don’t need to open a new thread with the same name.
I have an XML and need to convert it into a flat file.
I created the dictionary and the schema, but I am facing two different issues.
This flat file is fixed length, but when I define the schema as fixed length the resultant string is just one line, and it is not broken in the position defined as the record length. It just works when I define the schema as Delimiter and record character as newline.
When I invoke the convertToString, the content fields inside the records are fine, but the resultant string appears with the last character replaced by an empty space " " in all fields and for any case (fixed length and delimiter).

Any help will be appreciated,
Maldonado

Renato,

If possible upload a sample package with the above mentioned Schema and your parsing flowservice.

So that i can test it the same on my machine and the response will be accurate if your code has some problem.

HTH,
RMG

RMG,

Thanks for your support.
Inside this zip file there’s another zip (the package with the dictionary and the schema I built) and the ff I am using to test the schema.
When I run the test, it loads the ff content replacing the last character with blank character.

TIA,
Maldonado

ff schema
schema.zip (6.5 k)

Renato,

I loaded your package and looked int your created dictionary_MFG and schema_MFG and i have noticed that start/end position problems that are not matching with your flatfile (MFG.txt).

So for testing i created the dictionary/Schema with using field references of you dictionary (dictionary_MFG)and but i am not sure about the correct fields positions to specify in the dictionary that i have created.Some how i am able to parse the provided flatfile and extracted the fields from (ShipFromLocation to DateCode).

I am uploading the same package testSchema.zip in which you can notice the new dictionar/Schema (dic_Test,schema_Test)and a Test folder with testFF flowservice.Just run this service and see the Results DocumentReference (TestFF/recordWithNoId loops)all 30 lines have been extracted.

Actually Start/End positions according to file is (1-147) and so the postions in the Dictionary/Schema will be (0-147).

And one thing is you have to do make sure in the dictionary the fields postions that you have given is matching according to MFG.txt file.

let me know if you are still not clear on this.

HTH,
RMG

Test Schema
testSchema.zip (12.5 k)

RMG,

Thanks a lot for your answer. It helps me a lot.
I found my error: The End position must be the first character that is not included in the extraction.

Best regards,
Maldonado

Your welome,Anyways Glad it worked…

Goodluck,

RMG,

Since you are outstanding about flat file schema let me try to solve another issue that I found regarding ff schema.
I am trying to parse an inbound flat file with fixed length, but it just works if I create the schema parser as delimiter.
Since I need to catch if some of the records which length differs from the specified length (150), delimiter does not work in this case for me.
When I test the schema with fixed length parser, even with all records with length equal 150, it throws an exception: com.wm.ui.UiException: java.lang.NullPointerException

Renato,

When i looked into your flatfile it has delimiter,fixedlength position flatfile (both),so the schema is defined as Delimiter,FixedPosition.
If it is just a fixedlength file then all the data should be in a single line string which will be greater than 150chars.

Please clarify me?

Also try this way too use the FixedLength (radiobutton)option and so in the Record length field specify 150 and choose Field or Composite (newline) and give it a test shot.And make sure your flatfile should not exceed 150chars.

HTH,
RMG

RMG,

I am sorry for the misunderstanding.
The last question is related to another schema.
In this case we have a header, details, trailer structure, and all of them with 150 characters length.

When you say a single line, does it mean that I just can use fixed length if the flat file has one single line?

See below the details I am referring to, each one of them do not exceed 150 characters:

E999999496021 09823500076506 200409050000000000040910303000079398000000000127040905 1 0
E999996634708 05903502229806 200409050000000000040310303000079398100000000127040905 1 0
E999998813364 00413585033504 200409050000000000075540303000079398700000000127040905 1 0
E999996210078 01000837974803 200409050000000000102450303000079397500000000127040905 1 0

Since I need to consider an error when the line size exceeds 150 character, how should I build my schema to detect this condition?

TIA,
Maldonado

Renato,

I thought that you might be talking about the same MFG.txt related Schema.Its ok then.

When you say a single line, does it mean that I just can use fixed length if the flat file has one single line?

Yes,i mean it and since in if it a Fixedlength or variablelength flatfile then it should not have Record Delimiter but can have Field Delimiter.

Regarding if the line Exceeds 150chars then the FFSchema will put that all extra data in the “unDefData” string a place holder and you can see this in the pipeline once parsing the flatfile.So there is some way to handle this undefinedData but i have not gone much deeper.

If you have some time please go thru this documentation (ISFlatFileSchemaGuide.pdf)which explains how to handle this type of FF schemas.

Another option would be make sure before create Schema and request your initiator who is generating this file and not to send the data more than 150 chars or let him know the behaviour that FFSchema does truncating of the data.If they say that some times flatfile exceeds 150 then define the schema with that ending positions.

Just my thoughts,
RMG,

Sorry i forgot to mention this in my above post,

Once you parsed the flatfile data (convertToValues)and if you find any value in this “unDefData” string in the pipeline and Branch on this particular variable and generate an error report in your flow to handle this Exceed 150 Chars situation.
will this condition helps for you?

HTH,
RMG.

In the convertToValues service if you set validate=true option and so when the data exceeds then it will give out isValid = true or false,so basing on this also you can generate an error and handle the situation.

I have created a Flat file Dictionary. And I have specified the position of each field I need to access. I created Flat File Schema and wanted to test with my flat file which is of fixed length. The problem is first record appears right and starting from second record the position of the record moves one space and so on it continues. I cannot think of any combination which I haven’t tried. Can somebody help me on this.
Thanks

I could figure out the issue. Thanks