Search code examples
db2-400iseries-navigator

IBM i Series - execute query via cmd


I am an end user. I use the "Personal Communications iSeries Access for Windows"- I think it's specifically called Query Manager [QM], as I've discovered today. I came across commands which can execute .dtf files - essentially enabling me to download a file using cmd (multiple times via batch script). This is using the "rxferpcb.exe". This is useful for me, but there are queries in the libraries which needs to be run to refresh certain files before it can be downloaded.

http://www-01.ibm.com/support/docview.wss?uid=nas8N1010161 Above link give me the ability to download files.

Does anyone know how to execute the queries through cmd/scripts? I need to replicate the "Run Query" inside "Personal Communications". I am hoping to be able to run the query first through batch script, so that it produce an updated file, and then download the file.

I am talking from an end user perspective, not a developer. I can't use any schedulers or anything like that on the server. I have to send a cmd somehow to run the query. (and no, I don't want to use the keystroke macro in PC, because that is not efficient and it breaks a lot).

I've talked briefly to a programmer and he just gave me a hint of using COM, creating a handle and using the DLL. But after a few days on the web, I haven't come close to putting the 3 together.

Any hints appreciated.


Solution

  • To run a remote command on IBM i from Windows, you can use the RMTCMD command. The syntax is:

    RMTCMD "command to run"
    

    There is additional information here. This article is specifically for the newest version of IBM i Access Client Solutions, but it works just fine for me on IBM i Access for Windows and a Windows 7 PC. I suspect it will work for earlier versions as well.

    Note that someone has had to logon before rmtcmd will work. If you want to use it on a server, you need to call CWBLOGON first like this:

    CWBLOGON systemname /u userID /p password
    

    Once your remote session is complete you would then want to call CWBLOGON again to clear the password like this:

    CWBLOGON systemname /u userID /c
    

    You can find more information here.