Results 1 to 6 of 6

Thread: Append to table not working

  1. #1
    Senior Member
    Join Date
    Jan 2016
    Posts
    159

    Append to table not working

    I am using the following code to append records to some different tables in a daily transfer procedure. When I run the procedure, it gives the following error:

    FROM ar_invl

    ^
    Fatal I/O error reading index file - errno 2 (op=Index Read file=DATE at 20202000, size=538976288
    )
    Called from procedure - admin_admin_daily_transfer_click at line 102

    code:

    // Transfers line detail for invoices from ar_invl along with il_cur to il_temp

    if .not. used('ar_invl')
    use ar_invl in 0
    endif
    select ar_invl
    //ALWAYS ENSURE LATEST ar-invh DATABASE STRUCTURE IS IN USE
    COPY STRUCTURE TO il_temp
    use
    if .not. used('il_temp')
    use il_temp in 0
    endif
    select il_temp
    ZAP
    APPEND FROM il_cur
    APPEND FROM ar_invl
    copy to il_cur with production //updates the monthly invoice line detail table
    use

    // Transfers line items ofinvoices from ar_invl to il_all, the complete invoice history file
    if .not. used('il_all')
    use il_all in 0
    endif
    select il_all
    goto bottom
    APPEND FROM ar_invl
    use

    Does anyone see any obvious problems with my code?

  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Ontario, Canada
    Posts
    658
    Hi rdd,

    I'm not positive, although could the problem be here?

    Quote Originally Posted by rdd1963 View Post
    select ar_invl
    //ALWAYS ENSURE LATEST ar-invh DATABASE STRUCTURE IS IN USE
    COPY STRUCTURE TO il_temp
    use
    You are selecting ar_invl, copying the structure, then closing it with the use command.
    Later on when it is referenced again, ar_invl is no longer available.

    Cory

  3. #3
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,941
    Which line is line 102?

  4. #4
    Senior Member
    Join Date
    Jan 2016
    Posts
    159
    I have isolated the problem to the following section of the code below. I have put line numbers next to each line.

    95 // Transfers line items ofinvoices from ar_invl to il_all, the complete invoice history file
    96 if .not. used('il_all')
    97 use il_all in 0
    98 endif
    99 select il_all
    100 goto bottom
    101 APPEND FROM ar_invl
    102 use

  5. #5
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    1,941
    Hi rd,

    Your command that fails is onb line 102. The reason is tails is that on line 101, you are attempting to APPEND FROM a table that is open. That error is closing the current workarea: this seems to a common action when a table-related error occurs.

    From the APPEND FROM Wiki article:

    "If the FROM file is another Lianja table, it cannot be open and active at the time of the APPEND."

    hth,

    Hank

  6. #6
    Senior Member
    Join Date
    Jan 2016
    Posts
    159
    Thanks Hank,

    I closed the table and everything seems to work, after I reindexed the ar_all table.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us