Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Calling Parameterized Query/400's (?) from VB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling Parameterized Query/400's (?) from VB

    A Query/400 object (*QRYDFN) is not data that can be retrieved, but rather a utility program that takes data, and creates either a report or a new physical file (Table). The query must be executed via the RUNQRY (or is it QRYRUN - - I always get them confused) command. If the output of the query is a table, then the query must be first run in order to access the table. CA/400 provides a RMTCMD executable that will allow you to do this. I don't know how it might be done from within VB. Dave

  • #2
    Calling Parameterized Query/400's (?) from VB

    What is your purpose in wanting to run a Query Definition? I think you will be better off if you create a parameterized SQL statement in ADO. You can also create a parameterized Query in Microsoft Query that is included in Office. Bill > That said, I want to know if it's possible to run a parameterized query from VB using a query that was created using Query/400. I know that Query/400 will let you do parameterized queries if the query is saved then run from the command line, but I can't seem to get it to work in VB.

    Comment


    • #3
      Calling Parameterized Query/400's (?) from VB

      David I have done the RMTCMD from VB. I will paste my code below: This is a TeleVantage API written in VB. It logons on to a TeleVantage server, retrieves the CallerId Phone# when the phone is Answered, calls a DOS pgm REMOTEPHN.CMD which runs RMTCMD(The DOS pgm is also pasted below.) Note the SHell function which does the call to REMOTEPHN.CMD passing CallerID as a parm. RMTCMD fires MSIPHNC(an OS/400 CL pgm which calls an RPG pgm). Note that MSIPHNC runs in QUSRWRK as QUSER as a PJ(pre-start job). This was a big problem for me--but probably none at all for a Query running in batch. My problem was that the PJ job runs like a batch job and I needed to display green screen data in a PC5250 session(the master record of the person with the CallerID phone#). So the MSIPHNC Cl pgm does an OVRDSPF for each display file encountered to a session device as in: OVRDSPF FILE(MSIPHND) TOFILE(MMALIB/MSIPHND) DEV(&WSID) OVRDSPF FILE(ERRPHND) TOFILE(MMALIB/ERRPHND) DEV(&wsid) OVRDSPF FILE(MSICULD) TOFILE(MMALIB/MSICULD) DEV(&wsid) The workstation device is specified as a parm(PC04X) in DOS pgm REMOTEPHN.CMD. The device must be sitting on sign-on screen ready to go(unallocated)--but not actually signed-on because then it is allocated. so the VB pgm fires when the phone is answered--calling the DOS RMTCMD--which in turns fires MSIPHNC as PJ. MSIPHNC acquires a device (PC5250 Session PC04X) and the Master screen of the caller is displayed. Almost, but not quite perfect. The problem is the users want the PC5250 session to pop up front maximized. The VB shell function does give control of the window state but since it calls the DOS pgm, it controls the DOS window--and I have the DOS window where I want it with vbMinimizedNoFocus--this keeps the big black DOS screen out of the way. But I have no control over the PC5250 device window. Do you know how-- OR IF-- I can accomplish this. If I were to create an As/400 connection string and then use a VBProgramCall(which I do not know how to do--need syntax)would the called pgm MSIPHNC still run as a PJ in QUSRWRK? By bypassing the DOS RMTCMD would I be able to gain control of the PC5250 session by specifying vbMaximizeFocus? Sorry for the verbiage and thanks for your help. JoAnn
      Code

      Comment


      • #4
        Calling Parameterized Query/400's (?) from VB

        JoAnn, Is the problem, the window won't go to the front -or- it isn't maximized? If the problem is it isn't maximized, have you maxed it manually, then saved the session? Client Access Express will remember the windows last position and size from the last time it was used. Bill > The problem is the users want the PC5250 session to pop up front maximized.

        Comment


        • #5
          Calling Parameterized Query/400's (?) from VB

          Let me start by saying that I know little about AS/400's and zilch about RPG programming. But, I have built queries using the Query/400 interface. That said, I want to know if it's possible to run a parameterized query from VB using a query that was created using Query/400. I know that Query/400 will let you do parameterized queries if the query is saved then run from the command line, but I can't seem to get it to work in VB. In fact, using the express toolkit to link in Query/400 queries, they can only be linked in as tables. Are Query/400 queries technically point-in-time snapshot tables? Is it feasible or will I need to have the MIS group create custom stored procedures for this capability?

          Comment


          • #6
            Calling Parameterized Query/400's (?) from VB

            Bill, The problem is that the window does not pop in front of all the other applications and other PC5250 sessions the users have running. They usually keep the "remote" session minimized on the tool bar, but when it fires from a phone call, they would like it to pop up in front of their faces--where it can't be overlooked or ignored. Right now, when they answer their phone, they have to click the "remote" session on the toolbar to see whether it has found the master record for the caller or whether an error message is displayed saying the phone# is not in our master file. Until they exit from the session, another phone call cannot come through to that session. They often forget to click the session and the session may stayed logged on with an error message for a very long time, preventing other phone call lookups. The size of the window is not really important.

            Comment


            • #7
              Calling Parameterized Query/400's (?) from VB

              JoAnn, Since you are familiar with VB Script, I'd suggest you check out the help text for Scripting CAE Worksessions. One of the parameters is setting a session active - which I believe is the same as setting focus. Here is a silly example from the help text: ' Initialize the session autECLConnMgr.autECLConnList.Refresh autECLSession.SetConnectionByHandle(autECLConnMgr. autECLConnList(1).Handle) ' set to Active if not, and vice versa If autECLSession.autECLWinMetrics.Active Then autECLSession.autECLWinMetrics.Active = False Else autECLSession.autECLWinMetrics.Active = True End If Bill > The problem is that the window does not pop in front of all the other applications and other PC5250 sessions the users have running. They usually keep the "remote" session minimized on the tool bar, but when it fires from a phone call, they would like it to pop up in front of their faces--where it can't be overlooked or ignored. Right now, when they answer their phone, they have to click the "remote" session on the toolbar to see whether it has found the master record for the caller or whether an error message is displayed saying the phone# is not in our master file. Until they exit from the session, another phone call cannot come through to that session. They often forget to click the session and the session may stayed logged on with an error message for a very long time, preventing other phone call lookups. The size of the window is not really important.

              Comment

              Working...
              X