recordWithNoID

Hi,

How can I build a ffschema to parse this ff?

HEAD 234626 fgsdhsh - 1-1,Ok to identify using HEAD
165484 ashrhsh - 1-1 no identifier, but I know how it will look like and its mandatory in the file.
123564 gsertse - 1-1 no identifier, but I know how it will look like and its mandatory in the file.
LINE AA BB CC - 1-many,Ok to identify using HEAD

The problem is that the second and third row do not have a identifier and I dont know how to use different recordWithNoID?

/J

Hi Joh,

are lines 2 & 3 of fixed length?

Thanks,
Rankesh

Hi,

newline delimiter.

/J

Hi Joh,

is second/third line like 0-6 is one filed[165484], 8-15[ashrhsh] is other field?

Thanks,
Rankesh

Hi,

Yes different fieldd, but the thing is that second/third row do not use the same field structure, thats why I cannot use a recordWithNoID since you can only have one recordWithNoID that uses the same fields. Correct?

regard Joh

Joh,

You are correct, In these type of structures you need handle some part of data throuh code.

Note: To handle through code, I would suggest to confirm file structure & proceed further and make sure use logic the logic correctly and also use iterator, if file is big

Thanks
Sai

Hi Joh,

I got it, 2&3 lines are different in structure.

Can you please take 2-3 sample files and count the number of characters in 2 line and let us know?

If line2/3 is not of fixed length then you have to:
Split the file in 3 parts, 1. HEAD 2. Sandwiched data 3. LINE
HEAD and LINE are easy to handle as they have identifiers.

The tough job is to process Sandwiched data. You need to identify a pattern and come up with logic.

HTH.

Thanks,
Rankesh

I think joh is giving sample of only two line, in case if he is getting more than 2 line. I would suggest to use iterator

We have handled these type of file(having two recordWithNOID structures) using iterator & through code, once developer have good understanding in pattern of data

Hi Joh,

Procedure:

  1. define a record and define its field with appropriate length [in case it is fixed] More in Dict.png
  2. In schema definition set the dictionary. More in schema.png
  3. get the data in result. More in result.png

HTH.

Thanks,
Rankesh



result.PNG

Hi,

Rankesh, I dont think its possible to do it your way since the structure of row 2 and 3 are different and the record delimiter is newline. HEAD, LINE and TOTAL are easy to handle I agree.

See attatched testfile.
row 2:
pos 0-5 header
pos 5-12 text1
pos 12-28 text2
pos 28-53 num1
pos 53-55 text3

row3:
pos 0-5 header
pos 5-17 num1
pos 17-34 num2
pos 34-38 num3

Any suggestion how to code this custom convertToValues service?

I appriciate your help, thanks!
ff_testfile1.txt (286 Bytes)

Hi Joh,

I will get back to you.

Thanks,
Rankesh

Hi Joh,

I have written a crude code, which is not for production use. You need to modify and use ffiterator, if required. Please take help of attached code and improvised over it.

HTH.

Hi Sai,

Please add your inputs to improve the attached code.

Thanks,
Rankesh
FFTechCommunity.zip (27.3 KB)

Hi,

Rankesh, this is a nice solution.

Thanks,
Joh

Thanks for more and more getting utilities handy and helping the wM user community. :smiley:

-RMG

Thank you Joh/RMG.

Regards,
Rankesh