Query Execution
This section describes how to execute a query and display the table of information requested by the query. If some of the columns or rows in the table do not fit on the screen, you can scroll them onto the screen using window control.
Syntax Error
If you execute a query and get a syntax error, refer to the Messages section of this document.
Security Query execution is restricted by Thoroughbred Dictionary-IV system security. This includes Link and Schema security (restricted by password and terminal and operator access) and Format security (restricted data display for Data Name).
Selection methods
Section titled “Selection methods”When you run Thoroughbred Query-IV the system displays the Query Control window.
If you access Thoroughbred Query-IV by pressing F1 and selecting Query the system displays the Query View. From the Query View press F1 to execute and the system will display the Query Control window.
You may also execute a query from a 3GL program or 4GL program (script), or from a Thoroughbred Dictionary-IV menu.
From Thoroughbred Query-IV
Section titled “From Thoroughbred Query-IV”Query Framer If you have selected a query through the Query Framer, select 7-Execute (Framer) in the Query Control Window to execute the query.
This selection is exclusively used to execute the Framer command. If there is no command in the Query Framer, nothing is executed, even if a command exists in the EQL window.
EQL Use F3 in the EQL window to execute the command in the window. If you want to execute directly from the EQL window the query selected in the Query Framer, use F9. This generates the EQL command from the selections in the Query Framer.
The command in the EQL window is executed. If no command is in the EQL window, the query is ignored.
Dictionary-IV Menu To execute a query from a Thoroughbred Dictionary-IV menu, create a menu selection in the Menu definition. Use any selection code of your choice, and specify type "Q." If you specify a query name as the action, it will automatically be executed. If no name is specified, the system will prompt for the query name to execute.
From a 4GL script
Section titled “From a 4GL script”When you execute a query from a script or program, the following options are available:
Execute a range of queries in a library.Display the output on screen or print a hard copy.You must specify the options before you execute the query. A number of options are available. For more information, see CONNECT QUERY in the Script-IV Language Reference Manual.
The PRINTER option is ignored when you execute a query from a Menu or a Script.
Q4AUTO program
Section titled “Q4AUTO program”The following sample Thoroughbred Basic program, Q4AUTO demonstrates how to set up the parameters and execute the query from a program. A similar procedure can be used in scripts.
Program Q4AUTO (Page 1)
-------------------------------------------------------------------------LIBRARY: Q4 TITLE: QUERY-IV Sample Ext. Interface CREATED: 03/03/97PROGRAM: Q4AUTO OWNER: TSI LAST CHANGED: 10/09/97ALIAS NAMES:-------------------------------------------------------------------------10/09/97 Q4-Q4AUTO QUERY-IV Sample Ext. Interface PAGE: 1-------------------------------------------------------------------------
* Interfacing Thoroughbred QUERY-IV with Other Application Programs * This sample program illustrates how you can integrate queries * into application scripts or programs. * This allows you to embed Thoroughbred queries in your own * systems. * 0010 REM "Q4AUTO - Thoroughbred QUERY-IV Sample Interface" 0020 BEGIN
! This first segment allows the operator to select the options.
0100 REM "*** INPUT QUERY TO RUN ***" 0110 INPUT ‘CS’,@(0,17),"Enter Library Name: ",L$; IF CTL=4 GOTO 300 ELSE IF LEN(L$)<>2 GOTO 110 0120 INPUT @(0,18),"Enter FROM 6 character query name: ",N$; IF CTL=3 GOTO 110 ELSE IF CTL=4 GOTO 300 ELSE IF LEN(N$)>6 GOTO 120 ELSE IF N$="" N$=$000000000000$Program Q4AUTO (Page 2)
------------------------------------------------------------------------------
10/09/97 Q4-Q4AUTO QUERY-IV Sample Ext. Interface PAGE 2------------------------------------------------------------------------------
0130 INPUT @(0,19),"Enter TO 6 character query name: ",N1$; IF CTL=3 GOTO 120 ELSE IF CTL=4 GOTO 300 ELSE IF LEN(N1$)>6 GOTO 130 ELSE IF N1$="" N1$=$FFFFFFFFFFFF$ 0140 INPUT @(0,20),"Enter MASK 6 character query name:"N2$; IF CTL=3 GOTO 130 ELSE IF CTL=4 GOTO 300 ELSE IF LEN(N2$)>6 GOTO 140 0160 INPUT (0,ERR=0160) @(0,21),’CL’, "Do you want a hard copy? (Y?N) ", H$(""=0110,"Y"=0170,"N"=0170)
! The following is the routine that builds the values required to run ! the specific query. This code can be placed in any program.
0200 REM "*** BUILD X$FOR THOROUGHBRED QUERY-IV ***"
0210 DIM X$(84) ! Required as shown. 0220 X$(1,4)="AUTO" ! Required as shown. 0222 X$(84,1)="q" ! Required as shown.
! Starting Query Name: 0230 X$(5,8)=L$+N$ ! First 2 characters are Library Name. ! Characters 3-8 selects the starting query.
! Ending Query Name (without Library). 0240 X$(72,6)=N1$ ! Characters 1-6 are the ending query.Program Q4AUTO (Page 3)
-------------------------------------------------------------------------10/09/97 Q4-Q4AUTO QUERY-IV Sample Ext. Interface Page 3------------------------------------------------------------------------- 0250 X$(78,6)=N2$ ! Mask Query Name (without Library). ! Characters 1-6 are the Mask Definition
0260 X$(68,1)=H$ ! "N" = Screen Display ! "Y" = Printed Query
0270 X$(40,8)="ID" ! This is the PROGRAM to Run after the Query ! is completed. Set to any valid Program Name.
0280 RUN "IRPCA0" ! Executes the Query. Thoroughbred Dictionary-IV ! must be accessible.
0300 RUN "ID" ! Program to run if this program is terminated. ! Set to any valid Program Name.Table scrolling
Section titled “Table scrolling”When you execute a query and the query table is displayed on the screen, you may need to scroll the table to display all the columns and rows requested by the query. When the table is displayed, Thoroughbred Query-IV displays a prompt at the bottom of the screen, describing what you can do and allowing you to scroll the table.
Messages
Section titled “Messages”CR to continueThere are more rows in the table than are displayed on the screen. Press Enter to display more rows.
Enter Window ControlThere are more columns in the table than are displayed on the screen (the table is wider than the screen). You can scroll the table horizontally to display additional columns (see details below).
End of QueryThere are no more rows; the last row of the table has been displayed.
F4-ENDPress F4 to end the query and return to the place where you executed it.
Window control
Section titled “Window control”The following keys are available at the Enter Window Control prompt:
- Right Arrow
- To move the window right 1 character
- Left Arrow
- To move the window left 1 character
- Backspace
- To move the window left 1 character
- Up Arrow
- To move to the center of the table
- Home
- To move to the left and right sides of the table
- Tab
- To move the window right 5 characters
- Shift-Tab
- To move the window left 5 characters
- F9
- To toggle between 80 and 132 character displays (where available)
From the Query-IV Reference, version 8.9.1. Open this page in the PDF