webMethods

 View Only
  • 1.  convertToValues with multiple record structures

    Posted Tue April 20, 2021 07:46 AM

    I have inbound flatfile with header ,Detail, trailer. where all 3 have fixed length but fields definition is different. and Detail can be unlimited. And all header , Detail and Trailer records are Nth filed defined.
    Don’t have any record identifier in all 3 records.
    Can someone assist how can we use convertToValues here.


    #flat-file
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: convertToValues with multiple record structures

    Posted Tue April 20, 2021 12:33 PM

    One approach to consider:

    • Structure things to just ignore the first record. Presumably you’re using a REPEAT so you can tell which iteration you’re on.
    • To detect the trailer record there is likely a field that can be checked for the presence of a value. Regex of /\S/ may work for your case. If a detail field always has it and the trailer never does then that can be your signal that you’ve reached the end.

    I assume the header and trailer are padded to the record length so that all records are the same length. If not, that may present challenges.

    Another possible approach:

    • Open the file and read the stream yourself to move the file pointer passed the first record.
    • Call convertToValues as needed.
    • If convertToValues fails in a specific way for the trailer record, you can catch that and ignore it.

    HTH


    #webMethods
    #Integration-Server-and-ESB
    #flat-file


  • 3.  RE: convertToValues with multiple record structures

    Posted Wed April 21, 2021 08:06 AM

    Hi reamon,
    thankyou for quick replay.
    I have to read one element from header that is mandatory and from Detail I need to extract some data. problem is both detail and header following different structure even through length is same.
    do i can define both header and detail in same schema?


    #webMethods
    #Integration-Server-and-ESB
    #flat-file


  • 4.  RE: convertToValues with multiple record structures

    Posted Wed April 21, 2021 09:45 AM

    Yes, you can define both but the challenge is getting the parser to recognize each record type. Without a record identifier of some in the records you’ll only be able to use a “Default Record” layout – which might work depending upon the field boundaries. Would you be able to share some detail about the file records and fields? Perhaps someone will see a way to structure the parsing.


    #webMethods
    #Integration-Server-and-ESB
    #flat-file


  • 5.  RE: convertToValues with multiple record structures

    Posted Thu April 22, 2021 03:46 AM

    Unfortunately don’t have any recordIdentifier. if i want to read all Header , Detail and Trailer do I can define all schema separately and call Header schema for first record from file and Trailer for last record and Detail for remaining Detail records using convertToValues?


    #flat-file
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: convertToValues with multiple record structures

    Posted Thu April 22, 2021 09:46 AM

    Possibly. You’ll need to do some trial-and-error to figure out if such an approach will work. The transition from header to detail is easy – only the first record read as the header. The challenge will be determining when all detail records have been read and now at the trailer. No way to know without parsing it. Don’t forget to handle the case where the file has only a header and trailer, with no detail records.


    #Integration-Server-and-ESB
    #webMethods
    #flat-file