QUERY/iX Reference Manual
> Chapter 6 QUERY/iX COMMANDS (cont)XEQ |
||||||||||||||||||||
|
SyntaxX[EQ] filename [,NODATA]For example: XEQ CFILE,NODATAWhere filename = FILE and option = ,NODATA Parameters
DiscussionWhen the XEQ command is entered, QUERY reads the specified file and executes the commands until an end-of-file or another XEQ command is encountered. Any command input is also read from filename unless NODATA is specified. When an end-of-file is reached, control returns to the original command input device (in session mode, the terminal, or in job mode, the job input device). Only the first 72 characters of each record are read. You can continue a command on the next record by entering an ampersand (&) as the last non-blank character in the current record. If an error occurs while opening the data base in session mode, QUERY will close the XEQ file and prompt for another command. In job mode, QUERY closes the XEQ file and the job is terminated. An XEQ command within another XEQ file will close the first file and open the new one. The initial file is never reopened. QUERY performs an end-of-file on the first file and control transfers to the new file. The NODATA option specifies that the XEQ file only contains commands and does not contain any data needed by the command. QUERY will prompt you for the data. Control YWhen you enter CONTROL-Y during the execution of an XEQ file, QUERY will terminate the command currently executing, close the XEQ file and prompt for another command. If a FIND, MULTIFIND, or SUBSET command is executing when CONTROL-Y is entered, QUERY will print the following message. x ENTRIES HAVE QUALIFIED, DO YOU WANT TO CONTINUE SEARCHING?If you respond YES, QUERY will complete the search and execute the rest of the commands in the XEQ file. If you respond NO, QUERY will terminate the retrieval command, close the XEQ file, and prompt for another command. If you enter CONTROL-Y in response to a value prompt, as in the case of null values and the NODATA option, QUERY will terminate the command, close the XEQ file, and prompt for another command. In some cases, a retrieval command with null values will create an execution loop where the only way to terminate the command is with CONTROL-Y. The following is an example of an XEQ file which will create an execution loop. The XEQ file is named FINDACCT and contains: FIND ACCT#="" REPORT ALL XEQ FINDACCT,NODATA ExamplesExample 1 In this example, an XEQ file called FISET is used to define a particular QUERY session environment. The FISET file contains these records: DEFINE ORDERS CLERK 5 CUSTOMER,SALES PROCX TERMQUERY executes the DEFINE command and uses the other records as data in response to the DEFINE command prompts. If the NODATA option had been specified, QUERY would prompt you for each DEFINE prompt. >XEQ FISET DEFINE DATA-BASE = ORDERS PASSWORD = CLERK MODE = 5 DATA-SETS = CUSTOMER,SALES PROC-FILE = PROCX OUTPUT = TERM OUTPUT = TERM END OF XEQ FILEExample 2 This example shows how an XEQ file, PRXFIL, can be used to store and execute a pre-planned find-and-report sequence. It also shows the use of null data values and how the FIND CHAIN command can be used to access two data sets. Here, the information from CUSTOMER and SALES is used to prepare a bill. >XEQ PRXFIL,NODATA FIND CHAIN CUSTOMER.ACCOUNT,SALES.ACCOUNT="" END WHAT IS THE VALUE OF - ACCOUNT >>2 2 ENTRIES QUALIFIED REPORT BILL . . .Figure 6-2 Billing Report From an XEQ File BOBO'S MERCANTILE ACCOUNT #: 2 BILLING DATE: 06/19/85 HARLEY W LOND 1362 16TH AVE SAN FRANCISCO, CA 94122 PURCHASE DATE PURCHASE TOTAL 85/05/05 $418.22 TOTAL DUE $418.22The XEQ file PRXFIL contains: FIND CHAIN CUSTOMER.ACCOUNT,SALES.ACCOUNT="" END REPORT BILLSince you want to be prompted for a value when the FIND CHAIN command containing a null data value is called, you use the NODATA option in the XEQ command. Note that if REPORT were called directly from the file, XEQ NODATA would prompt you for report statements instead of reading them from the file. Therefore, the REPORT command is stored as a procedure, BILL, in the current Proc-file, and is initiated from PRXFIL after the FIND CHAIN command. The procedure BILL contains: REPORT H1,"BOBO'S MERCANTILE",43,SPACE A4 H2,"ACCOUNT #:",10 H2,ACCOUNT,14 H2,"BILLING DATE:",60,SPACE A2 H2,DATE,70 H3,FIRST-NAME,14 H3,INITIAL,20 H3,LAST-NAME,31 H4,STREET-ADDRESS,31 H5,CITY,20 H5,STATE,25 H5,ZIP,31,SPACE A2 H7,"PURCHASE-DATE",13 H7,"PURCHASE,"70,SPACE B3 H8,"TOTAL",70,SPACE A2 D,PURCH-DATE,8,E1 E1,"XX/XX/XX" R4,LOAD,QUANTITY R4,MULT,PRICE R4,ADD,TAX D,R4,70,E2 E2,"$$$,$$$.99" R0,ADD,R4 TF,"TOTAL DUE",9,SPACE B2,SKIP A TF,R0,70,E2 S,PURCH-DATE END
|