Schema question for a flat file parsing

Hello all:
Trying to get some direction on this:

I am having a problem creating schema for the following TICKET_RECORD flat file:
H 0 VALIDATION
Travelwithm Vacations 082520042004000242
Travelwitnm Vacations 082520042004000418248
Travelwithm Vtions
T 0 VALIDATION


SCHEMA DEFNITION (added space in front of segment id for H and T records

<SEGMENT ID="H ">
<POSITION NAME=“RECORD_TYPE” START=“0” LENGTH=“1”/>
<POSITION NAME=“FILLER” START=“1” LENGTH=“12”/>
<POSITION NAME=“SECURITY_QUALIFIER” START=“13” LENGTH=“1”/>
<POSITION NAME=“SECURITY_PASSWORD” START=“14” LENGTH=“10”/>
<POSITION NAME=“VENDOR_ID” START=“24” LENGTH=“12”/>
<POSITION NAME=“INTERCHANGE_DATE” START=“36” LENGTH=“6”/>
<POSITION NAME=“INTERCHANGE_TIME” START=“42” LENGTH=“4”/>
<POSITION NAME=“TRANSACTION_SET_TYPE” START=“46” LENGTH=“1”/>
<POSITION NAME=“CONFIRMATIONS_REQUESTED” START=“47” LENGTH=“1”/>
<POSITION NAME=“TEST_INDICATOR” START=“48” LENGTH=“1”/>
<POSITION NAME=“NUMBER_OF_RECORDS” START=“49” LENGTH=“5”/>
</SEGMENT>
<SEGMENT ID=“recordWithNoID”>
<POSITION NAME=“WHOLESALER_NAME_CHARACTER” START=“0” LENGTH=“50”/>
<POSITION NAME=“ARRIVAL_DATE” START=“50” LENGTH=“8”/>
<POSITION NAME=“RESERVATION_NUMBER” START=“58” LENGTH=“15”/>
<POSITION NAME=“LAST_NAME” START=“73” LENGTH=“15”/>
<POSITION NAME=“FIRST_NAME” START=“88” LENGTH=“15”/>
<POSITION NAME=“TICKET_CODE” START=“103” LENGTH=“5”/>
<POSITION NAME=“TICKET_DESCRIPTION” START=“108” LENGTH=“10”/>
<POSITION NAME=“TICKET_QUANTITY” START=“118” LENGTH=“3”/>
<POSITION NAME=“TICKET_COST” START=“121” LENGTH=“8”/>
<POSITION NAME=“HOTEL_CODE” START=“129” LENGTH=“30”/>
</SEGMENT>
<SEGMENT ID="T ">
<POSITION NAME=“RECORD_TYPE” START=“0” LENGTH=“1”/>
<POSITION NAME=“FILLER” START=“1” LENGTH=“12”/>
<POSITION NAME=“VENDOR_ID” START=“13” LENGTH=“12”/>
<POSITION NAME=“INTERCHANGE_DATE” START=“25” LENGTH=“6”/>
<POSITION NAME=“INTERCHANGE_TIME” START=“31” LENGTH=“4”/>
<POSITION NAME=“CONFIRMATIONS_REQUESTED” START=“35” LENGTH=“1”/>
<POSITION NAME=“TEST_INDICATOR” START=“36” LENGTH=“1”/>
<POSITION NAME=“NUMBER_OF_RECORDS” START=“37” LENGTH=“5”/>
</SEGMENT>
<SEG-ID>H</SEG-ID>
<SEG-ID>T</SEG-ID>
<LOOP Start=“recordWithNoID”>
<SEG

Harsh,

Please don’t double post. Especially one such as detailed as yours.
Have your tried setting skipWhiteSpace value to false in convertToValues. Just a thought as I’m unsure of the output.

Chris,

As far i know Harsh is not using WmEDI/convertToValues, he is using some custom made service for parsing.

And i didnt mentioned in the other post of using the WmEDI services but no details posted about that by him.

May be he can try to attempt of using this service,if he has WmEDI module installed over there.

Harsh,please try to maintain the posts which you have created earlier.

Regards,

Chris,

As far i know Harsh is not using WmEDI/convertToValues, he is using some custom made service for parsing.

And i did mentioned in the other post of using the WmEDI services but no details posted about that by him.

May be he can try to attempt of using this service,if he has WmEDI module installed over there.

Harsh,please try to maintain the posts which you have created earlier.

Regards,

Sorry about the double post Chris:
I will try the skipWhiteSpace hint.

Hello RMG:
Yes I am using the convertToValues service within:
here is my flow:
getTemplate
convertToValues.

The problem comes in my record structure which has TICKET_RECORD/H(space) or TICKET_RECORD/T(space), the TICKET_RECORD/recordwithNoID values are populated perfectly from the [ouput] of the convertToValues service, and this is because in my schema i had to put segment ID for H and T record with a space, to pull up the appropriate record from the flat file.

Appreciate the response, thanks

harsh

RMG: i am attaching my flow service and flat file with schema i am running thru this, i tried Chris, suggestion also but i still have the problem.

Thanks all!
Harsh

Scema and flat files
schema_flatfile.txt (5.9 k)


test.zip (4.5 k)

Harsh,

If you handling the problem with Space and recordWithNoID loop is working then what is the issue you have?

you mean when data is there in H/T records then it should overwrite the spaces right and still recordWithNoID loops should work.

RMG,

I think the problem he’s having is with the BRANCH. The schema is fine but he can not BRANCH on "record/H " only on “record/H”.

Hello Chris/RMG:
Thanks for the reply, Yes the problem i am having is when i branch as i now have a space added in the [output] record . "record/H ". So i cannot proceed further. Is there somewhere i can avoid this space and still parse the file properly.
regards and thanks

harsh

try trimming the recordid field to make it “record/H” and then BRANCH on it.

Chris: can you explain in some detail on how i can do that.
Thanks!

harsh

Use a map statement with trim as a transformer.
record.recordId ---- trim — record.recordId
should result in
"H " —> “H”
Just map the record back to itself using trim in the transformer step.
Then you should be able to BRANCH on record.recordId=“H”

HTH

Harsh,

Chris sugesstion should resolve your problem.
please try to implement the same way he mentioned.

Appreciate the response Chris/RMG but this still doesnt solve the problem:
This is how my TICKET_RECORD looks like:

converToValues[OUTPUT]–
maps—>
TICKET_RECORD
|

  • H<space>(HEADER record)
    -string values

  • recordWithNoID (repeating record)
    -string values

  • T<space>(TRAILER RECORD)
    -string values

The Header gets mapped from output into a H(space), i am not sure how i can use a trim , string transformer to trim a record.
My branch is for values under H ( header) or T (trailer):
TICKET_RECORD/H

regrds,
Harsh

Can you use two different Branch steps one having with H(Space) and the other with no space and similarly for T Record.

Will this work for you?

sorry let me also think if anyother options.

You’re correct but aren’t you BRANCHing on the field withing the record.
ie. TICKET_RECORD/H /field

RMG: In tried giving TICKET_RECORD/H(SPACE), but this space is not persisted in developer and disappears when i save the change in the branch.

Chris i finally ended up using Record/H /field to go into the desired sequence.

Going back to the schema is there a more effcient way to tackle this, i.e records with no id’s having values similar to Header and Trailer segment id?.

Thanks all for your timely suggestions and ideas, i am going to the next level :-).

Harsh

This is also a good option using Record/H /field to go into the desired sequence.Anyways you got the resolution.

goodluck,

hi,

I am using convertToValues for a fixed length flat file.
My input flat file has child records which can appear in any order.
for example:

MainRecord…
childrec1…
childrec1…
childrec2…
childrec2…
childrec1…
childrec1…

i have set ordered=false in my schema. But in the output i am gettting 2 separate doc list for childrec1. I want a single separate doc lists for childrec1 and childrec2. Has anybody faced this problem. Please give me solution for this problem of mine.
thanks,
naka

Noor,

Once you have parsed the flatfile you may have to map the seperated doclists what ever childrec1,childrec2 to another single doclists(childrec1),otherwise flatfile schema cannot handle this type of requirement since childrec1 is coming under childrec2.

May be there is easy way,let c if anyone have another clue to resolve.

HTH,
RMG.