MultiValue Tools

 View Only
  • 1.  Tab delimited file

    Posted 02-02-2023 12:24
    I am being asked to break a tab delimited file as part of an assessment. How do I identify the tab delimiter?

    ------------------------------
    Kimberly Crum
    Rocket Forum Shared Account
    ------------------------------


  • 2.  RE: Tab delimited file

    Posted 02-02-2023 12:49
    Hi Kimberly,

    The tab character is CHAR(9). You can get a section out of it with the
    FIELD function i.e. FIELD1 = FIELD(LINE,CHAR(9), 1). You can also use the
    CHANGE function to convert the line into a dynamic array and work with it
    like normal:

    LINE = CHANGE(LINE, CHAR(9), CHAR(254))
    FIELD1 = LINE<1>

    You might be able to use @AM in place of CHAR(254) depending on your MVDB
    version.

    Hope this helps.

    Joe Goldthwaite


    On Thu, Feb 2, 2023 at 10:23 AM Kimberly Crum via Rocket Forum <
    Mail@forum.rocketsoftware.com> wrote:

    > I am being asked to break a tab delimited file as part of an assessment.
    > How do I identify the tab delimiter? ------------------------------...
    > -posted to the "MultiValue Tools" forum
    > Invite your colleagues to join the Rocket Forum and grow our expert
    > network.
    > ------------------------------
    > [image: Rocket Software] <https: community.rocketsoftware.com="">
    > MultiValue Tools
    > <https: community.rocketsoftware.com/forums/forum-home/digestviewer?communitykey="9623ec16-9dfa-45ef-b0ef-482ea8980f44">
    > Post New Message Online
    > <http: community.rocketsoftware.com/participate/postmessage?groupid="133">
    > Invite your colleagues to join the Rocket Forum and grow our expert
    > network. Share this link. <https: community.rocketsoftware.com/register="">
    > Tab delimited file
    > <https: community.rocketsoftware.com/discussion/tab-delimited-file#bm0b24be3a-a9fa-488d-a610-519825ddea61="">
    > Reply to Group Online
    > <https: community.rocketsoftware.com/forums/all-discussions/postreply?messagekey="0b24be3a-a9fa-488d-a610-519825ddea61&ListKey=c397ae29-dbd0-4bf0-9a33-748df2e87c34"> Reply
    > to Group
    > <rocket_mvtools1_0b24be3a-a9fa-488d-a610-519825ddea61@connectedcommunity.org?subject=re:+tab+delimited+file>
    > [image: Kimberly Crum]
    > <https: community.rocketsoftware.com/network/members/profile?userkey="5adde1a6-f7eb-48d9-abde-018609f2255d">
    > Feb 2, 2023 12:24 PM
    > Kimberly Crum
    > <https: community.rocketsoftware.com/network/members/profile?userkey="5adde1a6-f7eb-48d9-abde-018609f2255d">
    > I am being asked to break a tab delimited file as part of an assessment.
    > How do I identify the tab delimiter?
    >
    > ------------------------------
    > Kimberly Crum
    > Rocket Forum Shared Account
    > ------------------------------
    > *Reply to Group Online
    > <https: community.rocketsoftware.com/forums/all-discussions/postreply?messagekey="0b24be3a-a9fa-488d-a610-519825ddea61&ListKey=c397ae29-dbd0-4bf0-9a33-748df2e87c34">*
    > *View Thread
    > <https: community.rocketsoftware.com/discussion/tab-delimited-file#bm0b24be3a-a9fa-488d-a610-519825ddea61="">*
    > *Forward
    > <https: community.rocketsoftware.com/forums/all-discussions/forwardmessages?messagekey="0b24be3a-a9fa-488d-a610-519825ddea61&ListKey=c397ae29-dbd0-4bf0-9a33-748df2e87c34">*
    > *Flag as Inappropriate
    > <https: community.rocketsoftware.com/discussion/tab-delimited-file?markappropriate="0b24be3a-a9fa-488d-a610-519825ddea61#bm0b24be3a-a9fa-488d-a610-519825ddea61">*
    > *Post New Message Online
    > <http: community.rocketsoftware.com/participate/postmessage?groupid="133">*
    >
    >
    >
    >
    > You are subscribed to "MultiValue Tools" as joe@goldthwaites.com. To
    > change your subscriptions, go to My Subscriptions
    > <https: community.rocketsoftware.com/preferences?section="Subscriptions">.
    > To unsubscribe from this community discussion, go to Unsubscribe
    > <https: community.rocketsoftware.com/higherlogic/egroups/unsubscribe.aspx?userkey="3873a97d-2498-4a32-a1f4-43821dddc57c&sKey=KeyRemoved&GroupKey=c397ae29-dbd0-4bf0-9a33-748df2e87c34">
    > .
    >




  • 3.  RE: Tab delimited file

    Posted 02-02-2023 14:35
    Thanks Joe.  I had my assessment yesterday and did use the FIELD statement with CHAR(9).  I have broken many flat files but never tab delimited. The key was figuring out what CHAR it was.  

    I appreciate your reply.

    ------------------------------
    Kimberly Crum
    Rocket Forum Shared Account
    ------------------------------



  • 4.  RE: Tab delimited file

    Posted 02-03-2023 09:29
    Kimberly,
    To add to previous responses.  If the tab delimited file is Unix then your end-of-line character is CHAR(10). If the tab delimited file is Windows then your end-of-line if CHAR(13):CHAR(10).  You may want to open the file in a HEX Editor to verify your data.


    ------------------------------
    Peter Gonzalez
    Programmer/Systems Analyst/EDI Developer
    Self Registered
    St. Louis MO US
    ------------------------------



  • 5.  RE: Tab delimited file

    Posted 02-10-2023 17:35

    Kimberly,

    I'd add that if the file is line-delimited (e.g.)

    abc <TAB> def <TAB> ghi <TAB> <END_OF_LINE>jkl <TAB> mno <TAB> pqr <TAB> <END_OF_LINE>stu <TAB> def <TAB> vwx<END_OF_LINE>

    It is better to use OPENSEQ/READSEQ (to exhaustion)/CLOSESEQ to process the file line-by-line rather than READ and loop on FIELD for the whole file.

    Regards

    JJ



    ------------------------------
    John Jenkins
    Thame, Oxfordshire
    ------------------------------



  • 6.  RE: Tab delimited file

    Posted 03-08-2023 15:00
    Edited by John Isael 03-08-2023 15:41

    I do this all the time.

    My box has lots of RAM, so reading in a large file is easy.

    READ record FROM F.FILE, XXX THEN

    record = CHANGE(record, CHAR(10), "")   ;* if on a UNIX box

    record = CHANGE(record, CHAR(9), @VM)

    AGAIN = @TRUE 

    LOOP

    WHILE AGAIN

       REMOVE ROW FROM record SETTING AGAIN

       * Now, each "cell" is its own multi-value in ROW and can be accessed as:

       * ROW<1,1>

       * ROW<1,2>

       * ect.

    REPEAT



    ------------------------------
    John Isael
    Rocket Forum Shared Account
    ------------------------------