How can I run the sqlite3 shell from rexx ?

Help
Deb
2008-01-17
2013-05-14
  • Deb
    Deb
    2008-01-17

    Hi,

    I am using regina 3.4 on WinXP.

    I have a situation where I need to issue the same set of queries to the sqlite command-line program (Sqlite3) a number of times. I want to write a rexx script to automate this. It sounds simple but I can't get it! I tried something like -

    inp.0 = 2
    inp.1 = 'sqlite3 test.db'
    inp.2 = 'select * from table1;'

    address system with input stem inp.1 output stream 'out.txt'
    ........
    ........

    It doesn't work. Any tips ?

    Rgds

     
    • kenneth kahn
      kenneth kahn
      2008-01-17

      >address system with input stem inp.1 output stream 'out.txt'

      Doesn't the target of 'stem' have to be an actual stem variable?

        i.e. address system with input stem inp. output stream 'out.txt'
                                            ----

       
    • Deb
      Deb
      2008-01-17

      sorry about the typo. I had used a stem variable "inp." in my code, and not "inp.1". still doesn't work.

       
    • Mark Hessling
      Mark Hessling
      2008-01-18

      What goes in the Input stem is the commands you would normally type into the sqlite program.
      So your program should be:

      inp.0 = 1
      inp.1 = 'select * from table1;'

      address system 'sqlite3 test.db' with input stem inp. output stream 'out.txt'

      If you are doing lots of sqlite commands, I'd suggest you use Rexx/SQL; it provides native interface into sqlite3, and saves you running the sqlite3 client each time.

      Cheers, Mark

       
    • Deb
      Deb
      2008-01-18

      Thanks a lot. It's working fine.
      One thing is that "address system" does not accept the full pathname of the program - I had to put the sqlite program in the current directory.

      (I am using the sqlite client just to check the updates made by another program...so i wanted a macro to avoid tedious typing.)

      Rgds

       
    • Deb
      Deb
      2008-01-18

      Used directory function to get around the issue..Rgds