Topic
  • 3 replies
  • Latest Post - ‏2014-03-20T17:17:21Z by charleswilt
Dangel
Dangel
3 Posts

Pinned topic read PC text file

‏2013-11-05T16:47:19Z |

I'm looking for the best method to solve this problem. 

I have a text file that is constantly having records written to on a PC on our network. 

I want to continuously read the new records from that file and write them into a DB2 file on our Power.

Thanks for your help!

  • krmilligan
    krmilligan
    450 Posts

    Re: read PC text file

    ‏2013-11-06T21:23:27Z  

    First, I would check if the process be changed to have records continuously written to a DB2 for i table on your Power server using ODBC, JDBC, etc. instead of writing to a file on the PC.

    There are ways of getting data from a text file into a DB2 table, but you'd need some way of identifying which records are new if it's continually being updated.

    You could FTP the text file into IFS on your IBM i system.  Once there you could use the CPYFRMIMPF command to load the data into a DB2 table - either the target table or a staging table.  Another option would be writing an external user-defined table function and then you could use an SQL SELECT statement to retrieve data from the text file in IFS.

    If you need assistance building a solution, the DB2 for i Center of Excellence team can be contracted to help.

     

     

  • Dangel
    Dangel
    3 Posts

    Re: read PC text file

    ‏2014-03-20T16:17:44Z  

    First, I would check if the process be changed to have records continuously written to a DB2 for i table on your Power server using ODBC, JDBC, etc. instead of writing to a file on the PC.

    There are ways of getting data from a text file into a DB2 table, but you'd need some way of identifying which records are new if it's continually being updated.

    You could FTP the text file into IFS on your IBM i system.  Once there you could use the CPYFRMIMPF command to load the data into a DB2 table - either the target table or a staging table.  Another option would be writing an external user-defined table function and then you could use an SQL SELECT statement to retrieve data from the text file in IFS.

    If you need assistance building a solution, the DB2 for i Center of Excellence team can be contracted to help.

     

     

    ok, we have made some good progress on this project. 

    We have decided to use ODBC to communicate between the PC and the i.

    Now, I am curious pros and cons of having the PC write to a DB2 table vs. a data queue.  The PC process will be 24x7.  Currently, we still have a "quiet' time (about 20 minutes) for the Power server that we end subsystems and do nightly saves.

    I should be able to develop the IBM side just as easily using either the table or the data queue.  Thanks for any experience/insights!

  • charleswilt
    charleswilt
    23 Posts

    Re: read PC text file

    ‏2014-03-20T17:17:21Z  
    • Dangel
    • ‏2014-03-20T16:17:44Z

    ok, we have made some good progress on this project. 

    We have decided to use ODBC to communicate between the PC and the i.

    Now, I am curious pros and cons of having the PC write to a DB2 table vs. a data queue.  The PC process will be 24x7.  Currently, we still have a "quiet' time (about 20 minutes) for the Power server that we end subsystems and do nightly saves.

    I should be able to develop the IBM side just as easily using either the table or the data queue.  Thanks for any experience/insights!

    A data queue has less overhead than a DB2 table thus better performance...but the DB table overhead has benefits of it's own...

    From your description, remote process continually feeding a stream of data...I'd say a data queue would be more appropriate.

    Either way you're have problems with your save unless move to using "Save While Active (SWA)" ...

    Charles