[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: reading from a flat file



you could in a read loop

        read the entire record into $rec

        then test the first byte of $rec

        if = A
          do parse-into-header-fields
          do header-stuff
        else
          do parse-into-detail-fields
          do detail-stuff
        end_if

this should work unless I am missing something


>Hi guys,
>
>I am trying to read from a flat file, which consists of data for the BI_HDR
>and the BI_LINE tables.  That is Header and detail info.  So one line of HDR
>can consist of one or more detail lines.  They are linked by a transaction
>ID.  The flat file looks like something below.  Can anyone suggest the most
>efficient way of acheiving this?
>
>Rec  TransID. Date     CustID Cust# counts totalamt
>type
>---  -------  ----     ------ ----- ------ --------
>A    11788    06/11/99 678    1     AXDDFF 7675
>
>B    11788    50       4000)
>B    11788    100      3675) line info
>
>Rec. type A,is the header info and Rec type B, will be the line
>info and linked by the TransID.
>
>Thanks
>DJ
>
>
>
>
>_______________________________________________________________
>Get Free Email and Do More On The Web. Visit http://www.msn.com
>
>