QUERY/V Reference Manual HP 3000 MPE/iX Computer Systems ABCDE HP Part No. 30000-90042 Printed in U.S.A.
The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material.
PRINTING HISTORY New editions are complete revisions of the manual. Update packages, which are issued between editions, contain additional and replacement pages to be merged into the manual by the customer. The dates on the title page change only when a new edition or a new update is published. No information is incorporated into a reprinting unless it appears as a prior update; the edition does not change when an update is incorporated.
to perform them. Appendix A contains all QUERY messages. Appendix B lists helpful information on numeric limits of QUERY commands and discusses the les used by QUERY during execution. Appendix C describes three ways to access a data base on a remote HP 3000. Appendix D discusses Native Language Support. Appendix E discusses self-describing les. Appendix F discusses user-de ned procedures and gives examples in programming languages. Appendix G lists the ASCII character set.
Contents 1. 2. 3. INTRODUCING QUERY/V STRUCTURE OF THE DATA BASE Fully-Quali ed Data Item Names . Data Types . . . . . . . . . . Data Values . . . . . . . . . . Literals . . . . . . . . . . . Compound Data Items . . . . . Data Set Relations . . . . . . . Sample Data Base . . . . . . . MODES OF ACCESS . . . . . . . Logging and Mode Selection . . . PASSWORDS . . . . . . . . . . QUERY CHARACTER SET . . . . MPE FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DEFINE . . . . . . . DESTROY . . . . . . DISPLAY . . . . . . DISPLAY LIST . . . . EXIT . . . . . . . . FIND . . . . . . . . FIND ALL . . . . . . FIND CHAIN . . . . FIND procedure . . . FORM . . . . . . . HELP . . . . . . . . JOIN . . . . . . . . JOIN procedure . . . LANGUAGE= . . . . LIST . . . . . . . . LISTREDO . . . . . MODE= . . . . . . . MULTIDB . . . . . . MULTIFIND . . . . . MULTIFIND ALL . . MULTIFIND procedure OUTPUT= . . . . . PASSWORD= . . . . PROC-FILE = . . . . REDO . . . . . . . . RELEASE . .
A. QUERY/V MESSAGES B. QUERY/3000 SPECIFICATIONS C. ACCESSING A REMOTE DATA BASE LIMITS USED BY QUERY . . . . . . . . . . . . . . . . . . . . . . FILES USED BY QUERY . . . . . . . . . . . . . . . . . . . . . . . METHOD 1: QUERY ON REMOTE SYSTEM . . . . . . . . . . . . . METHOD 2: QUERY ON LOCAL SYSTEM . . . . . . . . . . . . . . METHOD 3: USING A DATA-BASE-ACCESS FILE . . . . . . . . . . . D. NATIVE LANGUAGE SUPPORT E. SELF-DESCRIBING FILES EFFECTS OF NLS ON QUERY . . . . . . . . . . . . . . . .
Figures 1-1. 1-2. 1-3. 2-1. 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 3-7. 3-8. 3-9. 3-10. 3-11. C-1. C-2. C-3. ORDERS Data Base Structure . . . . . Sample Entry Values . . . . . . . . . IMAGE/QUERY Environments . . . . . Job Mode Operation . . . . . . . . . FORM ITEMS Output . . . . . . . . FORM PATHS Output . . . . . . . . FORM SETS Output . . . . . . . . . FORM data item name Output . . . . . FORM data set name Output . . . . . FORM Output . . . . . . . . . . . . General Report Format . . . . . . . .
Tables 1-1. 2-1. 2-2. 2-3. 3-1. 3-2. 3-3. 3-4. 3-5. 3-6. 3-7. 3-8. 3-9. 3-10. 3-11. 3-12. B-1. B-2. B-3. B-4. B-5. B-6. B-7. B-8. B-9. B-10. B-11. B-12. B-13. D-1. Data Item Types and Values . . . . . . . . . . . . . . . . . Command Categories and Functions . . . . . . . . . . . . . . Procedure Commands . . . . . . . . . . . . . . . . . . . . Commands Used to De ne Procedures . . . . . . . . . . . . . FIND Command Relational Operators . . . . . . . . . . . . . MATCHING Pattern Operators . . . . . . . . . .
1 INTRODUCING QUERY/V QUERY/V provides a simple method of accessing IMAGE data bases without programming e ort. You can use QUERY to do the following: enter data modify or delete data values retrieve data which meets selection criteria report on the data retrieved You perform these operations by entering simple commands consisting of English keywords such as FIND and REPORT. You can request information about the function, format, and parameters of QUERY commands with the HELP command.
Appendix F for further discussion. All of the tasks except user-de ned report procedures can be accomplished without programming. If you are developing programs which access IMAGE data bases through the IMAGE library procedures, QUERY makes an excellent debugging aid. You can alter the data base content using your program and then use QUERY to examine the data and determine the results of your programmed changes.
Fully-Qualified Data Item Names If you are referring to a data item which appears in more than one data set and/or data base, you must specify which data set and data base to access. A particular data item can appear in more than one data set within a given data base, and a particular data item can appear in more than one data base. You can specify the data item in three ways: by specifying the data set through the DATA-SET= command and the data base through the DBLIST= command.
Data Values If you use QUERY to enter a value for a data item of type P (packed decimal), you should be aware of the way QUERY handles the sign of the value. A di erent code is used for the sign of a value entered with a plus sign than for a value entered without a sign. However, when QUERY retrieves unsigned and positive type P data items with the same value, they are considered to be equivalent. For example, +2 and 2 are equivalent. Data items with values +0, 0, and -0 are also equivalent.
Table 1-1. Data Item Types and Values TYPE MINIMUM MAXIMUM INTEGER I1 -32768 +32767 I2 -2,147,483,648 +2,147,483,647 I4 +9,223,372,036,845,775,808 +9,223,372,036,854,775,807 J1 -9999 +9999 J2 -999999999 +999999999 J4 -999999999999999999 +999999999999999999 K1 0 +65535 K2 0 +4,294,967,295 Zn * - (n digit number) + (n digit number) Pn * - (n - 1 digit number)'' + (n - 1 digit number)'' -1.157920 x 1077 +0.863617 x 10-77 REAL R2 -0.863617 x 10-77 R4 -1.
Compound Data Items IMAGE allows the data base designer to specify compound data items. A compound data item is one that occurs more than once in the same data entry. Each occurrence of the data item is called a sub-item. Each sub-item can have a value, and QUERY can locate and update any or all sub-items. If you update only the rst sub-item, QUERY preserves the existing values of all other sub-items. Data Set Relations There are three types of IMAGE data sets: manual master, automatic master, and detail.
Figure 1-1. ORDERS Data Base Structure Figure 1-2.
Note: This data base is not meant to be a practical application but rather is designed to illustrate as many IMAGE/QUERY features as possible. MODES OF ACCESS Each person using QUERY to access a data base must specify one of the 8 modes of access. The following table lists the capabilities you will have in each mode.
MODE RESULT 5 The data base is locked for some operations and may slow the rate of activity somewhat. If mode 1 or mode 5 users are already accessing the data base, you must use mode 5. Mode 2 users can replace entries, and one mode 4 user can replace, add, or delete; or mode 8 users can read entries. You have exclusive access to the data base. No other users can replace, add, or delete entries. 6 7 8 An important advantage of using modes 5 through 8 is that the data base is is opened for reading only.
Figure 1-3.
Logging and Mode Selection Opening the data base in modes 1 through 4 allows data base modi cations to be logged to a log le and subsequently recovered if there is a system failure. If the data base administrator has enabled the data base for logging, certain requirements of the logging system must be met before the data base can be accessed in modes 1 through 4. These requirements are the responsibility of the data base administrator and console operator, and are discussed in the IMAGE Reference Manual .
MPE FILES For those readers who are not familiar with the MPE Operating System, here is a brief introduction to some MPE concepts you may need to understand while using QUERY. MPE treats an input/output device as a le with a standard name. For example, $STDLIST is the name of the standard output le for both session and job modes. A le is equated to a device class which may be a line printer, terminal, disc, or other peripheral device.
2 USING QUERY/V QUERY can be run in either session mode (interactive) or job mode (batch). In session mode, QUERY issues command prompts, error messages, and other messages of general interest to you. The manner in which QUERY proceeds depends upon your responses to QUERY messages and prompts. In job mode, QUERY reads commands and other input from a job le and prints messages on the $STDLIST device. Before accessing data in either session or job mode, you must de ne the QUERY environment.
Log on to the computer using the MPE :HELLO command. MPE prints information about your session and another colon. Initiate QUERY using the MPE :RUN command. QUERY prints the subsystem banner and prompts for a command with >. Accessing Data Before you can access data, you must open a data base by specifying a data base name, password, and access mode. You can do this at the beginning of your QUERY session by using the DATA-BASE= or DEFINE command, both of which will prompt you with >> to supply information.
USING SERIAL READ 4CONTROL5 Y < CONTROL Y > 2 ENTRIES HAVE QUALIFIED, DO YOU WANT TO CONTINUE SEARCHING? NO > Exiting QUERY When you are nished using QUERY, you use the QUERY EXIT command to end QUERY execution. To terminate your MPE session, use the MPE :BYE command. MPE responds by printing the number of seconds of CPU time used and the number of minutes you were connected to the system. >EXIT END OF PROGRAM :BYE CPU=6. CONNECT=6.
:EDITOR HP32201A.7.15 EDIT/3000 MON, MAR 23, 1987 11:49 AM (C) HEWLETT-PACKARD CO. 1985 /TEXT EXAMPLE /LIST ALL 1 :JOB EXAMPLE,MANAGER.DATAMGT,ACCOUNTS 2 :RUN QUERY.PUB.SYS 3 DATA-BASE=ORDERS 4 CLERK 5 5 6 DATA-SETS=CUSTOMER 7 FIND LAST-NAME IS MARTENSEN 8 REPORT ALL 9 EXIT 10 :EOJ /EXIT :STREAM EXAMPLE #J539 : Figure 2-1. Job Mode Operation Discussion In a job le, the QUERY prompts (> and >>) must be excluded. Only MPE commands require prompts (:).
QUERY COMMANDS QUERY commands are divided into seven categories according to their function. The categories can be summarized as follows: CATEGORY Environment Retrieval Reporting Updating Procedure Operation Utility FUNCTION De nes data base(s) and conditions for QUERY execution. Locates information to be used by other commands. Prints speci ed information. Modi es the data base(s). Operates on procedures in the current Proc- le. Operates on XEQ les. See below.
Table 2-1. Command Categories and Functions CATEGORY Environment COMMAND CLOSE DATA-BASE= DATA-SETS= DBLIST= DEFINE JOIN JOIN PROCEDURE LANGUAGE= MODE= MULTIDB OUTPUT= PASSWORD= PROC-ENTITY = Retrieval FIND FIND ALL FIND CHAIN FIND PROCEDURE MULTIFIND MULTIFIND ALL MULTIFIND PROCEDURE SUBSET SUBSET PROCEDURE 2-6 USING QUERY/V FUNCTION Closes a data base opened with the MULTIDB command. Speci es the primary data base, password, and access mode. Speci es the data set list for the primary data base.
Table 2-1. Command Categories and Functions (continued) CATEGORY Updating COMMAND UPDATE ADD UPDATE DELETE UPDATE REPLACE UPDATE PROCEDURE Reporting LIST REPORT REPORT ALL REPORT PROCEDURE Operation COMMENT XEQ Procedure ALTER CREATE CREATE SPACE DESTROY DISPLAY DISPLAY LIST RENAME Utility ASSIGN EXIT FORM HELP LISTREDO REDO RELEASE SAVE SETLOCKS FUNCTION Adds data entries to the data base. Deletes data entries from the data base. Modi es the values of data items.
Table 2-1. Command Categories and Functions (continued) CATEGORY COMMAND SHOW TRANSBEGIN TRANSEND TRANSMEMO UNDO VERSION FUNCTION Displays the current data base list, JOIN, LOCKOPTION, and user language. Marks the beginning of a logical logging transaction. Marks the end of a logical logging transaction. Allows a message to be written to the log le. Restores the entries retrieved from the previous FIND, MULTIFIND or SUBSET.
After you have opened a primary data base using the DATA-BASE= or the DEFINE command, you can open additional data bases using the MULTIDB command. The MULTIDB command prompts for the password, access mode, and data set list. You can press 4RETURN5 at the DATA-SET prompt. You can open multiple data bases with one MULTIDB command. To terminate the command, press 4RETURN5 at the DATA-BASE= prompt.
When a retrieval command is executed, QUERY searches the appropriate data set(s) for the data entries which satisfy the relation(s). QUERY then stores the record addresses of these entries in a select le. When a REPORT, REPORT ALL, UPDATE DELETE or UPDATE REPLACE command is executed, the select le is used to locate the data entries. A retrieval command can be stored as a procedure in a Proc- le for repeated use without re-entering the command.
REPORTING DATA The reporting commands, LIST and REPORT, display selected information from the data base(s). QUERY provides several reporting techniques which enable you to examine the data in the data base without writing a program. You can report information in three ways: Use one command to retrieve data entries for a single report with automatic formatting. Use two commands, one to retrieve data entries which can be used repeatedly and another to produce a report with automatic formatting.
USING PROCEDURES IN A PROC-FILE A single QUERY command can be stored as a named procedure for repeated use without re-entering the command. The commands which can be used in a procedure are listed in Table 2-2. You execute a procedure by referencing it with a form of the command used in the procedure. Refer to Table 2-2 for the commands that are used to execute procedures.
Table 2-3. Commands Used to Define Procedures COMMANDS CREATE DISPLAY ALTER DESTROY RENAME FUNCTION Creates a procedure or copies it from an MPE ASCII le and stores it in the current Proc- le. The CREATE SPACE option shows the number of unused records in the current Proc- le. Lists the names of the procedures in the current Proc- le or lists individual procedures with line numbers for use in editing. Edits a procedure stored in the current Proc- le.
3 QUERY/V COMMANDS The following characteristics apply to all commands. Command names can be spelled out completely or abbreviated. The minimum abbreviation is speci ed in the syntax under each command. In most cases, any subset of the characters between the full command name and the abbreviation may be used. For example, the syntax of the FORM command speci es FO[RM]. In this case, any of the following may be used: FORM, FOR, or FO.
ALTER Inserts, replaces, and deletes lines of a procedure stored in the current Proc- le. Syntax 2 3 A LTER procedure name For example: >ALTER REP22 Whereprocedure name = REP22 Parameter procedure name is the name of a procedure stored in the current Proc- le. Discussion When you enter the ALTER command, QUERY prompts you for insert, replace, and delete statements by printing >>. Each statement operates on a line or range of lines in the procedure.
ALTER ALTER - INSERT STATEMENT Inserts lines into the procedure. QUERY prompts for each statement and line with >>. Syntax >>/I, m >>line >>line . . Parameters m line is the number of the procedure line after which you want to insert statements. is the new line you want to insert. Discussion The lines which follow the insert statement are inserted into the procedure following line number m . You cannot insert lines in front of the rst procedure line.
ALTER ALTER - REPLACE STATEMENT Deletes the speci ed line or range of lines and replaces them with the lines following the replace statement. QUERY prompts for each statement and line with >>. Syntax 2 >>/R,m ,n line . . 3 (current lines m through n are listed) >>replacement line >>replacement Parameters m n replacement line is the number of the rst procedure line you want to replace. is the number of the last procedure line you want to replace. If n is not speci ed, only line m is replaced.
ALTER ALTER - DELETE STATEMENT Deletes the speci ed line or range of lines. QUERY prompts for each statement with >>. Syntax 2 >>/D,m ,n 3 (deleted lines are listed) Parameters m n is the rst line you want to delete. is the last line you want to delete. If n is not speci ed, only line m is deleted. If line n is speci ed, the range of lines from m to n is deleted. Discussion If you try to delete all the lines in the procedure, an error message is printed.
ALTER ALTER - END STATEMENT Terminates the ALTER command and saves the procedure. Syntax >>/E Discussion QUERY continues to prompt you for insert, delete, or replace statements until you enter /E. If the ALTER command is terminated using 4CONTROL5 Y, the entire command is ignored and the procedure remains in its original state. To save your changes, you must terminate the ALTER command with /E.
ALTER 001 002 003 004 005 006 007 008 009 REPORT H1,"TO DATE:",6 H1,DATE,20 H2,"BOBO'S MERCANTILE",45 D1,STOCK#,36 D1,LASTSHIPDATE,48,E2 E2,"XX/XX/XX" S,LASTSHIPDATE END QUERY/V COMMANDS 3-7
ASSIGN Enables or disables the data base lock option. Syntax 2 AS SIGN 32 3 data base name: LOCKOPTION = ON OFF For example: >ASSIGN LOCKOPTION = OFF Parameters data base name ON OFF is the name of a data base opened with either DEFINE, DATA-BASE=, or MULTIDB. You must specify the data base name if more than one data base is open. enables the lock option. The default ON. disables the lock option.
CLOSE CLOSE Closes a data base opened with the MULTIDB command. Syntax 2 3 CL OSE data base name For example: >CLOSE ORDERS Parameter data base name is the name of a data base opened with the MULTIDB command. Discussion The CLOSE command allows you to close a data base opened with the MULTIDB command, without exiting from QUERY. The data base that was opened with DEFINE or DATA-BASE= commands is una ected and remains open until the end of your job or session.
COMMENT Allows you to add comments to an XEQ le. Syntax 2 3 CO MMENT text Parameter text is a string of up to 698 characters. A comment can be continued with an ampersand. Discussion The COMMENT command cannot be embedded with the DEFINE, DATA-BASE=, REPORT, ALTER, or UPDATE ADD commands since it will be interpreted as input.
CREATE CREATE Stores a command as a named procedure in the current Proc- le. Syntax 2 3 C REATE procedure name, le name command END For example: >CREATE FIND6,FINDFILE >CREATE FINDNAME,FIND LAST-NAME IS "" END Parameters procedure name le name command is a name composed of 1 to 8 alphanumeric characters chosen by you. The rst character must be alphabetic. No special characters or spaces are allowed.
CREATE characters are the line numbers. Even if you keep the le unnumbered, QUERY commands or parameters should not be entered in this part of a record. Example :EDITOR HP32201A.7.17 EDIT/3000 MON, MAR 23, (C) HEWLETT-PACKARD CO. 1983 1987 2:51 PM /ADD 1 FIND 2 CUSTOMER.ACCOUNT IS "" 3 END 4 // /KEEP FINDFILE /EXIT END OF SUBSYSTEM :RUN QUERY.PUB.SYS HP32216C.00.08 QUERY/3000 MON, MAR 23, 1987 2:51 PM COPYRIGHT HEWLETT-PACKARD CO.
CREATE Examples >CREATE FINDNAME, FIND >FIND FINDNAME WHAT IS THE VALUE OF >>MURTZ WHAT IS THE VALUE OF >>FRANZONI WHAT IS THE VALUE OF >>X USING SERIAL READ 2 ENTRIES QUALIFIED LAST-NAME IS "","","" END LAST-NAME LAST-NAME LAST-NAME The previous example illustrates the result of creating a procedure with null values. When the procedure is executed, QUERY prompts for three LAST-NAME values. A value must be supplied for each null value.
CREATE SPACE Reports the number of unused records in the current Proc- le. Syntax 2 3 C REATE SPACE Discussion You can use the CREATE SPACE command to nd out how much space is left in the current Proc- le before you begin creating a new procedure. If you try to create a procedure that is larger than the space left in the current Proc- le, you will receive an error message and part of the procedure will be lost.
DATA-BASE= DATA-BASE= Speci es the primary data base to be accessed by QUERY. Syntax 2 3 2 3 DATA- B ASE = data base name For example: >DATA-BASE=ORDERS.PUB.SYS >B=DBAFILE Parameter data base name is the name of an IMAGE data base. The data base may reside in any group or account on the local HP 3000 or a remote HP 3000 as long as you are allowed access to it through the MPE le security.
DATA-BASE= Passwords and Access Modes Passwords are created by the data base administrator or designer who will tell you which one you may use. The password determines which data sets and/or data items in the data base you are allowed to read and/or write. A password must be entered exactly as it was created, with including upper and lowercase characters.
DATA-BASE= This example shows two users for the ORDERS data base. User 2 must open the data base with mode 5 because mode 6 is incompatible with the access mode of user 1. User 1 has requested mode 1 (exclusive read and write access).
DATA-SETS= Informs QUERY which data set to reference in the primary data base if a data item name which appears in more than one data set is used in a FIND, LIST, REPORT, or UPDATE command. Syntax 2 3 2 DATA-SET S= data set list 3 For example: >DATA-SETS=PAYROLL,ACCTREC >DATA-SETS= Parameter data set list is a list of data sets you want to access. The list can contain data set names and dummy data set names. Each name must be separated from the next name by a comma.
DATA-SETS= You must type the name of the data set you want to access. If the name you provide does not match the names listed, QUERY repeats the prompt. If you decide you do not want to access the listed data sets, you may abort the command by pressing 4RETURN5 instead of entering a data set name. You will be prompted for another command. Job Mode QUERY cannot prompt you for the desired data set in the event of ambiguity.
DATA-SETS= MODE = 1 MODE = >>4RETURN5 DATA-SETS = INVENTORY,SALES DATA-SETS = >>4RETURN5 PROC-FILE = >>4RETURN5 OUTPUT = TERM OUTPUT = >>4RETURN5 Example 2 This example illustrates how QUERY uses the data set list, clears it, and enters data set names automatically. The DEFINE command shows that the data set list currently contains the SALES data set. When using the FIND command to search entries with STOCK#=6650D22S, the SALES data set is automatically used since it is in the data set list.
DBLIST= DBLIST= Informs QUERY which data base to access for multiple data set retrieval and reporting. Syntax 2 DBLIST= data base list 3 For example: >DBLIST=JOBS,SALES >DBLIST= Parameter data base list is a list of data bases opened with the DEFINE, DATA-BASE=, and/or MULTIDB commands. Each data base name must be separated from the next with a comma. If data base list is not included, the data base list is cleared.
DBLIST= access the listed data bases, you may abort the command by pressing 4RETURN5 instead of entering a data base name. You will be prompted for another command with >. Job Mode In job mode, QUERY cannot prompt you for the desired data base in the event there is ambiguity. The data base to be accessed is chosen according to the following rules: If exactly one data base containing the data item appears in the data base list, QUERY uses that data base.
DBLIST= >>END >SHOW DBLIST TAPES >MULTIFIND JAZZ.YEAR=70 USING SERIAL READ 3 COMPOUND ENTRIES QUALIFIED > The SHOW DBLIST command shows that ALBUMS is the only data base in the data base list. When the JOIN command is entered, ALBUMS is automatically used for the rst occurrence of the JAZZ data set. In the second occurrence, the data base list is not used since a fully-quali ed data item name is speci ed. The DBLIST= command clears the data base list.
DEFINE Lists the status of all of the environment commands for the primary data base and enables you to change the environment speci cations. Syntax 2 DEF INE 3 Discussion When you enter the DEFINE command for the primary data base in either session or job mode, QUERY lists the state of each of the environment commands and prompts you for changes. The primary data base is the data base opened by the DEFINE or DATA-BASE= command.
DEFINE If you are not sure that you will have access to the data items you need, you can change the password with the DEFINE, DATA-BASE=, or PASSWORD= command. Refer to the command description of each prompt for more information about the purpose of each environment speci cation.
DESTROY Deletes a procedure from the current Proc- le. Syntax 2 3 DE STROY procedure name For example: >DESTROY REP23 Whereprocedure name = REP23 Parameter procedure name is the name of a procedure stored in the current Proc- le. Discussion This command deletes a procedure from the current Proc- le. If the Proc- le has not been declared, or if the named procedure does not exist in the Proc- le, QUERY informs you and prompts you for another command.
DISPLAY DISPLAY Lists a procedure which is stored in the current Proc- le. Syntax 2 3 m ,n D ISPLAY procedure name , le name For example: 2 3 >D PROCA,2,4 Where procedure name = PROCA, m = 2, n = 4 >DISPLAY GETIT Where procedure name = GETIT >DISPLAY REP4,FILEB Where procedure name = REP4, le name = FILEB Parameters procedure name m and n le name is the name of a procedure in the current Proc- le. Refer to Table 2-2 for a list of commands which can be used in procedures.
DISPLAY FILE DOES NOT EXIST, BEING CREATED Example >DISPLAY FIND1,FINDSET >DISPLAY FIND1 PROCEDURE: FIND1 001 002 003 FIND CUSTOMER.ACCOUNT IS "" END In the example above, the FIND1 procedure is written to le FINDSET. Then FIND1 is listed on the terminal. >OUT=LP >D FINDCH >OUT=TERM >D FINDCH PROCEDURE: FINDCH 001 002 003 FIND CHAIN CUSTOMER.ACCOUNT,SALES.ACCOUNT IS "" END When OUTPUT=LP, the list is printed on the QSLIST device. When OUTPUT=TERM, the list is printed on the terminal.
DISPLAY LIST DISPLAY LIST Lists the names of all procedures in the current Proc- le. Syntax 2 3 D ISPLAY LIST Discussion If you enter this command, QUERY prints the names of all procedures in the current Proc- le. If no Proc- le has been declared, you are informed and prompted for another command. If you have speci ed OUTPUT=LP (refer to the OUTPUT= command), the DISPLAY LIST command prints information on both the QSLIST device and the terminal in session mode.
EXIT Terminates QUERY execution. Syntax 2 E XIT 3 Discussion You can enter the EXIT command whenever QUERY prompts for a command. QUERY execution terminates and control is returned to the operating system. The operating system then prompts you for a command with the colon prompt character. In job mode, you must use an EXIT command to terminate a set of QUERY commands. The EXIT record should be followed by an MPE command (usually :EOJ).
FIND FIND Locates entries in a single data set. Syntax 2 F IND 32 AND OR #LIMIT=i; 3 relation 2 3 item identi er M ATCHING " pattern" relation 2 3 item identi er M ATCHING "pattern" 2 . . . END 3 For example: >FIND BADGE# IS "09.18" Where relation = BADGE# IS "09.
FIND "pattern" relation is de ned by pattern matching speci cations. Pattern must be enclosed in quotation marks. takes the form: [data base name:] [data set name.] data item name [(subscript)] relop "value" [,"value"]... END relop is a relational operator as shown in Table 3-1. value is the data item value. It must be the same type and within the same value range as the data item named in the relation. Value need not be enclosed in quotation marks unless the value contains special characters.
FIND Table 3-1. FIND Command Relational Operators OPERATOR # MEANING EQ is equal to (Multiple values may be used with these operators.) = IS <> ISNOT INE < ILT LT >= > <= INLT IGT INGT IE GE GT LE IB value 1 , value 2 NE is not equal to (Multiple values may be used with these operators.
FIND is represented as: C1 and C3 or C2 and C3 Up to 50 logical connectors may be used in one FIND command. Compound Items A compound data item is an item that occurs more than once in the same data entry. Each occurrence of the data item is called a sub-item. Each may have a value and any or all sub-items in a data entry can be accessed.
FIND You are prompted once for each null value in the command. You must supply a value for each null value in the procedure. You can use a known invalid response if you do not want to nd another entry. For example: >FIND CUSTOMER.CITY IS "","" WHAT IS THE VALUE OF - CITY >>PETALUMA WHAT IS THE VALUE OF - CITY >>X USING SERIAL READ 1 ENTRIES QUALIFIED. When using null values from a FIND command in an XEQ le, the XEQ parameter NODATA must be used.
FIND clear the data set list if you are unsure about what it contains. PRODUCT was entered in the data set list automatically as a result of the previous command, so QUERY uses PRODUCT and does not prompt for the data set name.
FIND Generic Search A pattern consists of a series of the following special characters that indicate the type of data that can be entered in that position: text a u l b d ? upper or lowercase alphabetic character (A-Z, a-z) uppercase alphabetic character (A-Z) lowercase alphabetic character (a-z) blank digit (0-9) any character Note: A pattern must specify the maximum number of characters allowed for the data item length.
FIND You can indicate a selection of acceptable patterns as part of the MATCHING pattern. Each possible choice is separated by a comma. For example: MATCHING "ABCD,DEFG,dddd" The values \ABCD", \DEFG", or any four digits are acceptable. Range A range of acceptable characters for a single character position can be indicated with the colon. All characters within the range are acceptable. This acts as shorthand for listing a series of single characters in ASCII sequence.
FIND (*) means that zero or more occurrences can be matched. (These repetition indicators cannot follow items enclosed within brackets [ ].) For example: MATCHING "d+b*" MATCHING "Xd+b*" MATCHING "M {A,C,d}+" MATCHING "d*b*" MATCHING "[d+]b*" MATCHING "a+" MATCHING "Xu*b*" MATCHING "M+ {A,D,d}*" The plus sign indicates repetition of the digit, with at least one occurrence required for the match. Thus, \2" or \745227" or \55" are acceptable, but a blank is not.
FIND MATCHING "1ddd" MATCHING "[d] [d!:dd] b* [AM,PM]" MATCHING "{1:7} {0:7}* b*" MATCHING "ddd-dd-ddddb" MATCHING "[(ddd)] ddd-dddd b*" Accepts an integer between 1000 and 1999. Can also be expressed as \1000:1999". Accepts a time such as \3:00 PM" or \12:00". Accepts a number greater than zero with at least one digit and no leading zeros, such as \2047", or \1", or \74". Accepts any social security number, such as \044-24-0474". Accepts a phone number with an optional area code.
FIND ALL FIND ALL Locates all entries in the data set regardless of the value of the data item speci ed. Syntax 2 3 3 2 F IND ALL #LIMIT=i; item identi er For example: >FIND ALL LABOR.BADGE# Where item identi er '' = LABOR.BADGE#'' >F ALL F-NAME Where item identi er = F-NAME Parameters i is an integer specifying the maximum number of qualifying entries you want to retrieve. i must be >= 0. If you specify a negative number, QUERY ignores your input.
FIND ALL . . 24536173 24566356 10034765 >FIND ALL LAST-NAME USING SERIAL READ 13 ENTRIES QUALIFIED Both FIND commands locate entries in the CUSTOMER data set. The REPORT command prints the value of ACCOUNT for each entry.
FIND CHAIN FIND CHAIN Locates data entries from a detail data set and one or more of its corresponding master data sets. Syntax 2 3 3 2 F IND CHAIN #LIMIT=i; item identi er 2 6 6 4 and item identi er or 8 9 IS > > > > < = IE "value" EQ > > > > : ; = 3 7 7 5 9 8 IS > > > > < = IE "value" EQ > > > > : ; = 2 . . . END 3 For example: >F CHAIN EMPLOYEE.BADGE#,LABOR.BADGE# IS "1234" OR& >> EMPLOYEE.BADGE#,LABOR.BADGE# IS "9018" Whereitem identi er = EMPLOYEE.BADGE#,LABOR.
FIND CHAIN detail search item is the name of a data item de ned as a search item for the detail data set. This search item must provide the link between the detail set and the previously de ned master set. value is a data item value. It must be the same type and within the same value range as the master search item and detail search item of the data item. Value must be enclosed in quotation marks only if it contains special characters or blanks. Null values may be used.
FIND CHAIN 4 ENTRIES QUALIFIED >R ALL ACCOUNT LAST-NAME FIRST-NAME INITIAL STREET-ADDRESS CITY STATE ZIP CREDIT-RATING =76623455 =MCFALL =JEFFREY =X =6650 MONTEREY ROAD =CARMEL =CA =93921 =3.20000 STOCK# DESCRIPTION =6550D22S =BASEBALL BAT ACCOUNT LAST-NAME FIRST-NAME INITIAL STREET-ADDRESS CITY STATE ZIP CREDIT-RATING =54283545 =MAYFIELD =WILLIAM = =39 41ST AVE. =PETALUMA =CA =10101 =8.
FIND procedure Executes a FIND procedure stored in the current Proc- le. Syntax 2 2 3 F IND procedure name ,character 3 For example: >FIND ACCTS Where procedure name = ACCTS >F USERS,X Where procedure name = USERS, and character = X Parameters procedure name character is the name of a FIND command previously stored as a procedure using the CREATE command.
FIND procedure PETALUMA CA 10101 8.50000 54283545 4397D13P 1 4590 276 0 121585 122085 The FINDACCT procedure contains: FIND CHAIN CUSTOMER.ACCOUNT,SALES ACCOUNT IS "" END In this example, QUERY prompts for the value of ACCOUNT. The REPORT ALL command prints the entry data. The rst entry is from the CUSTOMER master data set. The second entry is from the SALES detail data set.
FORM Lists information about data bases currently being accessed. Syntax FO 2 33 2 2 6 36 ALL RM 6 6 data 4 2 base name : ITEMS 6 PATHS 6 3 6 SETS 6 4 data 77 77 77 77 name 5 5 item data set name For example: >FORM >FO PATHS >FORM PRODUCT Where data set name = PRODUCT >FO ACCOUNT Where data item name =ACCOUNT Parameters ALL data base name ITEMS PATHS SETS used alone will display the data sets, data items, and path information for every open data base to which you have access.
FORM Discussion FORM provides information about the currently open data base(s). The information contains only the names of data sets and data items to which you have at least read access. No other data sets and data items are listed. If no data base is currently de ned, QUERY issues an error message and prompts you for another command. If OUTPUT=TERM, the listing is sent to the standard list device for the job or session. If OUTPUT=LP, the listing is sent to the le named QSLIST.
FORM DATA BASE: ORDERS TUE, MAR 9, 1987, 11:29 AM DATA BASE LANGUAGE ATTRIBUTE: NATIVE-3000 PATH IDENTIFYING INFORMATION MASTER SET NAME ASSOCIATED DETAIL SET NAME SEARCH SET NAME SORT ITEM NAME CUSTOMER SALES ACCOUNT PURCH-DATE DATE-MASTER SALES PURCH-DATE DETAIL SET NAME SEARCH ITEM NAME SORT ITEM NAME ASSOCIATED MASTER SET NAME PURCH-DATE CUSTOMER SALES ACCOUNT !STOCK# PURCH-DATE DATE-MASTER Figure 3-2.
FORM 6. Number of computer words per entry. 7. Maximum number of entries a block can contain. DATA BASE: ORDERS TUE, MAR 9, 1987, 11:29 AM DATA BASE LANGUAGE ATTRIBUTE: NATIVE-3000 ITEM NAME: ACCOUNT J2 <----- IS A MEMBER OF THESE SETS: CUSTOMER <----SALES 1 2 Figure 3-4. FORM data item name Output Discussion 3-4 1. Data item type. 2. Data set names.
FORM 4. Maximum number of entries CUSTOMER can contain. 5. Number of entries in the data set. Discussion 3-6 ( gure follows) 1. ACCOUNT is a key which links the detail data set SALES to the master data set CUSTOMER. The detail search item is is also named ACCOUNT. 2. DATE is a key item in DATE-MASTER linked to the SALES data set through the search item PURCH-DATE. 3. PURCH-DATE is also used for sorting. 4. The SALES data set can contain at most 12012 entries. 5. Data set relations.
FORM DATA BASE: ORDERS TUE, MAR 9, 1987, 11:29 AM DATA BASE LANGUAGE ATTRIBUTE: NATIVE-3000 SET NAME: CUSTOMER,MANUAL ITEMS: ACCOUNT, LAST-NAME, FIRST-NAME, INITIAL, STREET ADDRESS, CITY, STATE, ZIP, CREDIT-RATING, CAPACITY: 2003 J2 1 -----> <> X16 X10 U2 X26 X12 X2 X6 R2 ENTRIES 15 SET NAME: DATE-MASTER,AUTOMATIC ITEMS: DATE, CAPACITY: 211 X6 2 -----> <> ENTRIES: 18 SET NAME: SALES,DETAIL ITEMS: ACCOUNT, STOCK#, TOTAL, PURCH-DATE, CAPACITY: 12012 <----- 4 J2 U8 J2 X6 1 ----->
HELP Lists information about the function, format, and parameters of QUERY commands. Syntax 2 2 32 2 command name FU NCTION For example: H ELP 3 32 2 FO RMAT 32 2 PA RAMETERS 3333 >HELP >HELP FORM FUNCTION Where command name = FORM >H DEFINE Where command name = DEFINE Parameters command name FUNCTION FORMAT PARAMETERS consists of any QUERY command name such as DISPLAY or RENAME. You may use the abbreviation of the command. indicates that only the function of the command should be printed.
HELP Examples Example 1 You can abbreviate the HELP command and the command you are asking about. >H DATA-BASE FUNCTION SPECIFY THE PRIMARY DATA BASE FORMAT DATA-BASE= DATA BASE NAME PARAMETERS DATA BASE NAME - NAME OF Y < CONTROL Y > 4CONTROL5 Example 2 The order of FUNCTION, PARAMETERS, and FORMAT parameters can vary.
JOIN De nes the compound data set used for multiple data set retrieval. Syntax 2 2 3 3 ,data item equivalence . . .3 J OIN data item equivalence 3 32 2 2 END ;data set equivalence ,data set equivalence . . . Parameters data item equivalence has the form: [data base name:] data set name. data item name [(subscript)] [@] TO [@] [data base name:] data set equivalence END 3-56 data set name.
JOIN Discussion The JOIN command allows the retrieval and reporting of data item values from multiple data sets by creating a logical relation between data sets. The relation is established by equating a data item from one set with a data item from a second data set. These data item equivalences, of which QUERY allows up to 52, de ne a compound data set.
JOIN H3,"in Stock",56 H3,"Sold",70,SPACE A2 D1,PRODUCT.STOCK#,6 D1,PRODUCT.DESCRIPTION,24 D1,SALES.QUANTITY,39 D1,INVENTORY.ONHANDQTY,56 D1,SALES.PURCH-DATE,70,E1 E1,"XX/XX/XX" END Report on Sales Stock No.
JOIN Data Item Types Equated (joined) data items can be of di erent types and lengths, with the exception of character types, which may only be equated to other character types. If two items of di erent lengths are equated, QUERY treats the shorter one as if it were padded with blanks to match the length of the longer data item. Null Connecting Data Items The IMAGE subsystem initializes numeric type data items to zero, and character type data items to ASCII null.
JOIN USING SERIAL READ 2 COMPOUND ENTRIES QUALIFIED The data set equivalence above is not actually executed until a MULTIFIND or MULTIFIND ALL command is entered to retrieve some or all of the compound entries you have formed. Two compound entries have been retrieved from which the desired report can be created. >REPORT ALL EMP:EMP-DETAIL EMP-# EMP-NAME MGR-# =1792 =G. SMITH =1833 EMP:MGR-DETAIL EMP-# EMP-NAME MGR-# =1833 =H. JONES =3421 EMP:EMP-DETAIL EMP-# EMP-NAME MGR-# =1833 =H.
JOIN >JOIN SALES-DETAIL.STOCK# TO STOCK-DETAIL.STOCK# <--------(SALES DETAIL)--------> <---------(STOCK-DETAIL)---------> ----------------------------------------------------------------------ACCT-# STOCK-# QUAN STOCK-# DESCR ON-HAND ----------------------------------------------------------------------222 60 25 60 BOLT 1200 ----------------------------------------------------------------------- If you want to keep all of the entries in the SALES-DETAIL data set, use the @ parameter.
JOIN >JOIN SETA.ITEM1 TO @ SETB.ITEM2,& >> SETB.ITEM3 TO @ SETC.ITEM3,& >> SETC.ITEM2 TO @ SETA.ITEM2 When joining three or more data sets, the @ parameter must be propagated. Any data item equivalence naming a data set on the opposite side of the TO from the @ parameter must also have an @ sign associated with it, and the @ must be on the same side of the TO as that data set. Propagating @ Signs Example 1 In this example, an @ sign is associated with SETA in the equivalence between SETA and SETB.
JOIN In the next example, the @ sign associated with SETB requires that an @ be associated with SETC. The @ associated with SETC requires that an @ be associated with SETD if SETD was joined to another data set. Since SETD is not connected to another data set, no @ sign is associated with it. >JOIN SETA.ITEM1 TO SETB.ITEM2,& >> SETB.ITEM2 @ TO SETC.ITEM3,& >> SETC.ITEM4 @ TO SETD.
JOIN In summary, @ signs may form the following connections: Note that @ signs may not take the following form: Note 3-64 It may be helpful to diagram the connections established by the JOIN command as shown in this section. When the @ parameter is used, a diagram can allow you to easily see where an @ must be propagated. A diagram will also reveal any illegal connections made with the @ parameter.
JOIN procedure JOIN procedure Executes a JOIN procedure stored in the current Proc- le. Syntax 2 2 3 J OIN procedure name ,character 3 For example: >JOIN PROCA Whereprocedure name = PROCA >J USERS X Whereprocedure name = USERS, character = X Parameters procedure name character is the name of a JOIN command previously stored as a procedure using the CREATE command. The procedure must exist in the current Proc- le speci ed in the PROC-FILE = command or in the response to the PROC-FILE prompt.
LANGUAGE= Speci es the user language. Syntax langname LA NGUAGE = langnum For example: 2 3 >LANGUAGE=SPANISH >LA=12 Parameters langname langnum is the name of a supported user language. is the user language ID number. Each language is associated with a unique ID number. Discussion The user language is di erent from the data base language. The user language is used for determining collating sequences and language dependent display characteristics.
LIST LIST Prints complete or partial entries from a single data set with automatic formatting and headings. Syntax 2 L IST 2 END 3 32 data base name: 3 data set name data item list FOR relation AND relation . . . OR For example: >LIST LABOR FOR BADGE# IE "09.18" AND F-NAME IE JOE Wheredata set name = LABOR, relation = BADGE# IE "09.
LIST enclosed in quotation marks (") unless the value contains special characters. Any value not contained within quotation marks is upshifted. For example, California is converted to CALIFORNIA before it is compared to data item values in the data base. Value must be an exact match for character type data items (type U and X). You may use null values. Refer to \Using Null Values" under the FIND command for more information. must be included in a procedure. END Table 3-3.
LIST Table 3-4. Field Widths of Data Item Types ITEM TYPE FIELD SIZE (in characters) I1 6 I2 11 I4 20 J1 5 J2 10 J4 19 K1 5 K2 10 R2 12 R4 22 Zn n +1 (maximum = 20) n (maximum = 20) n (maximum = line length) * n (maximum = line length) * * Absolute maximum = 136 Pn Un Xn Listing a Subset of the Data You can list a subset of the data in three ways: 1. Use the data item list form of the commands to specify particular items you want to list.
LIST Determining the Data Set to be Used If you use the LIST command form specifying a data set name, there is no ambiguity as to which information will be listed. If you use a data item list , you should consider the following: If the command has a FOR clause, QUERY uses the data item in the rst relation to determine the data set to be listed. If there is no FOR clause, QUERY uses the last item in the data item list .
LIST ACCOUNT 24536173 24566356 STOCK# 6650D22S 6650D22S QUANTI PRICE TAX TOTAL PURCH- 3 1 598 12500 20 750 0 120885 0 121585 Example 4 This example lists CUSTOMER entries with ACCOUNT greater than 55555555.
LIST >LIST STOCK# FOR QUANTITY IGT 2 AND ACCOUNT ILT 88888888 STOCK# 6650D22S 3586T14Y 5405T14F 7892Z43Y Example 8 SALES and INVENTORY are both in the data set list so QUERY must prompt you for the data set.
LISTREDO LISTREDO Displays one or more commands in the command history bu er. Syntax 2 LISTR EDO 32 32 m ,n 8 9 ;ABS < = 3 : ;REL ; ;UNN Parameters m ,n displays a range of commands in the command history bu er. m is the starting number (least recent) and n is the ending number (most recent). If m is equal to n , only the speci ed command is displayed. m and n can either be absolute (positive) numbers or relative (negative) numbers; however, both must be either relative or absolute.
LISTREDO Discussion The LISTREDO commands displays the commands from least recent to most recent. Up to 20 commands can be displayed. The LISTREDO command is added to the command history bu er. Example In this example, the rst LISTREDO command is issued when the command history bu er contains two commands. However, when the bu er is displayed, three commands are listed since the LISTREDO command is added to the bu er.
MODE= MODE= Changes the mode of access to the primary data base. Syntax 2 3 M ODE = mode number For example: >MODE=3 Wheremode number = 3 Parameter mode number is an integer from 1 to 8 representing the access mode you want to use. Discussion You can use this command to change your mode of access to the primary data base. If the MODE= command is entered, QUERY rst closes the current primary data base before attempting to open the data base with the new access mode.
MULTIDB Opens additional data bases and modi es their environment speci cations. Syntax 2 MULTID B 32 data base name 3 Parameter data base name is the name of an IMAGE data base. Discussion MULTIDB enables you to open two or more data bases for simultaneous access, and can also be used to modify the environment of those data bases already opened with a MULTIDB command. MULTIDB can specify an additional data base only after a primary data base has been de ned with the DEFINE or DATA-BASE= command.
MULTIDB If you are not sure that you will have access to the data items that you need, you can change the password with the MULTIDB command. You must qualify the rst data item name in the command with the appropriate data base name. If you are accessing a data base: other than the one opened with a DEFINE or DATA-BASE= command. with a command other than JOIN, MULTIFIND, SUBSET on a compound select le, or REPORT on a compound data set select le. with a command for which a data base name can be speci ed.
MULTIFIND Retrieves compound entries from a compound data set speci ed by the most recent JOIN command. Syntax 2 MU LTIFIND AND OR 32 #LIMIT=i; 3 relation 2 3 "pattern" item identi er M ATCHING relation 2 3 item identi er M ATCHING "pattern" 2 . . . END 3 Parameters i is an integer specifying the maximum number of qualifying entries you want to retrieve. i must be >= 0. If you specify a negative number, QUERY ignores your input.
MULTIFIND data set name data base name: data item name dummy data set name 3 2 "value" "value" (subscript) relop , ... 2 3 $MISSING $MISSING data item name can be any data type. Refer to previous de nition. relop is a relational operator as shown in Table 3-1. value is the data item value. It must be the same type and within the same value range as the data item named in the relation . Value need not be enclosed in quotation marks unless the value contains special characters.
MULTIFIND The JOIN above combines the three data sets into one compound data set using the common data item STOCK#. Until a MULTIFIND or MULTIFIND ALL command is performed, the compound data set is only de ned, but not created.
MULTIFIND ------------------------------------------------------------------ The following MULTIFIND command does not retrieve any entries from the join. >MULTIFIND ACCT# = 444 AND ON-HAND >0 The MULTIFIND command with the $MISSING parameter retrieves the following entry.
MULTIFIND ALL Retrieves all compound entries from a compound data set speci ed by the most recent JOIN command. Syntax 2 3 2 MU LTIFIND ALL #LIMIT=i; 2 data base name: 3 3 data set name. data item name dummy data set name. Parameters i is an integer specifying the maximum number of qualifying entries you want to retrieve. i must be >= 0. If you specify a negative number, QUERY ignores your input.
MULTIFIND ALL Example Performing a MULTIFIND ALL on the data set SALES creates the compound data set from which the following compound entries are retrieved: >MULTIFIND ALL SALES-DETAIL.
MULTIFIND procedure Executes a MULTIFIND procedure stored in the current Proc- le. Syntax 2 3 2 MU LTIFIND procedure name ,character 3 For example: >MULTIFIND SALESREP Whereprocedure name = SALESREP >MU USERS,X Where procedure name = USERS, and character = X Parameters procedure name character is the name of a MULTIFIND command previously stored as a procedure using the CREATE command. The procedure must exist in the current Proc- le de ned by the PROC-FILE = or DEFINE command.
OUTPUT= OUTPUT= Selects the output device for the FORM, HELP, DISPLAY, LIST, REPORT, and VERSION commands. Syntax 2 3 O UTPUT = TERM LP For example: >OUTPUT=LP >O=TERM Options TERM LP indicates that output is to be displayed on the device speci ed as $STDLIST. ($STDLIST is normally a terminal in session mode and a line printer in job mode.) indicates that output is to be sent to the le designated as QSLIST.
OUTPUT= The following :FILE command is used to send the output to a magnetic tape. In this case, TAPE is the name of the class of devices known as magnetic tapes. :FILE QSLIST;DEV=TAPE To send output to a disc le, follow the instructions below. If QSLIST is not a permanent le, you can specify the following le command: :FILE QSLIST;DEV=DISC QUERY will build the new le as an ASCII le with variable length records of 136 bytes. The rst byte contains carriage control for the le.
OUTPUT= Example 2 The next example illustrates the method for sending output to a tape device. In this case, a procedure from the Proc- le is listed rst on the terminal and then on a tape. The 4BREAK5 key is used to return to MPE. QSLIST is equated to a magnetic tape device. QUERY execution is resumed and the output device is changed to QSLIST. The procedure is written to the QSLIST device and the output device is set to the terminal again.
PASSWORD= Changes your password for the primary data base. Syntax 2 3 2 PA SSWORD = password 3 Parameters password is the word you have been given by the data base administrator to use when accessing the data base. You must enter this word exactly as it was created. A distinction is made between passwords entered in lowercase or entered in uppercase. Discussion You can change your password, thus changing the group of data to which you have access.
PASSWORD= In the example above, the CLERK password is speci ed. The request to add an entry to the INVENTORY data set is rejected since CLERK does not allow write access to it. When the password is changed to DO-ALL, QUERY allows the user to add to the INVENTORY data set.
PROC-FILE = Speci es the name of the current Proc- le. Syntax 2 3 2 P ROC-FILE = lename ,n 3 For example: >PROC-FILE =FILEP,50 Where lename = FILEP and n = 50 Parameters lename is the name of an MPE ASCII le. The le may reside in any group or account, as long as you are allowed read and lock access to it through the MPE le security. If you do not have read and lock access a le system error 93, (FS-93) security violation, will occur.
PROC-FILE = Examples Example 1 In the following example DISPLAY LIST is used to list the procedures in the current Proc- le. MANPROC contains ve procedures. >PROC-FILE =MANPROC >DISPLAY LIST FIND1 FIND2 UPD1 REP4 REP5 Example 2 You can create a Proc- le with the PROC-FILE = command. If you do not specify the number of records QUERY creates a le with 126 records.
REDO Edits and executes a command in the command history bu er. Syntax 2 m 2 3 4 RED O -n 3 5 string Parameters m displays the command that has this absolute number. Absolute numbers are positive numbers beginning with the rst (least recent) command in the command history bu er. For example, 1 is the rst command in the bu er. (This is the number displayed by the LISTREDO command with the ABS option or with the default of absolute numbering.) displays the command that has this relative number.
REDO each character to be deleted. The D subcommand can be followed by the I subcommand. lists all the valid editing subcommands, then redisplays the line you are currently editing. inserts one or more characters preceding the character above the I. Type I followed by the characters to be inserted. displays the complete command in its current state, then redisplays the line you are currently editing. replaces one or more characters beginning with the character above the R.
REDO Example 2 In the next example, the string parameter is used to specify the command to be edited. First, ve commands in the bu er are displayed with the LISTREDO command. When the REDO command is executed, the most recent command that begins with FIND is displayed. >LISTREDO ,5 1) DEFINE 2) FIND ALL CUSTOMER.ACCOUNT 3) MULTIDB 4) FIND PROCF5 5) LISTREDO ,5 >REDO FIND FIND PROCF5 I2 FIND PROCF25 4RETURN5 . . .
RELEASE RELEASE Removes all locks set by SETLOCKS command. Syntax 2 REL EASE 3 Discussion The RELEASE command unlocks the data set(s) that were locked by the SETLOCKS command. If the command is entered while the SETLOCKS command is not in e ect, you will receive the following message: SETLOCKS COMMAND WAS NOT IN EFFECT When data set locks are released, LOCKOPTION=OFF (overridden by the SETLOCKS command) will take e ect with the same value it had prior to the SETLOCKS command.
RENAME Changes the name of a procedure in the current Proc- le. Syntax 2 3 REN AME old procedure name, new procedure name For example: >RENAME UPCUST,UPACCT Where old procedure name =UPCUST and new procedure name =UPACCT Parameters old procedure is the name currently associated with the procedure. name new procedure is the name you want to use for the procedure in the future. Refer to the CREATE command for naming rules.
REPORT REPORT Lists data item values of entries located by a retrieval command in the format you specify. Syntax 2 3 R EPORT report statement; . . .
REPORT Table 3-5. REPORT Statements STATEMENT FUNCTION Prints title, column headings, page numbers, time of day, and the date at the top of each report page. Prints data item or register values or a character string in the column position speci ed. Sorts data based on the value of a speci ed data item. Prints a data item value or character string whenever the value of an appropriate \sort item" changes. Prints count, average, or totals for logical groups or entire report.
REPORT Skipping and Spacing When paging is in e ect, the following rules govern skipping and spacing: 1. If a SKIP B and a SPACE B are both associated with the same output line, the SKIP B is processed before the SPACE B. 2. If there are not enough lines remaining on the current page to satisfy a SPACE B, a page is ejected and then the spacing is e ected. 3. If a SKIP A and a SPACE A are both associated with the same output line, the SPACE A is ignored. 4.
REPORT TITLE OF REPORT GROUP TITLE GROUP TITLE PAGE NO. HEADER HEADER HEADER DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL SUBTOTAL SUBTOTAL SUBTOTAL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL DETAIL SUBTOTAL SUBTOTAL SUBTOTAL GRANDTOTAL GRANDTOTAL GRANDTOTAL Figure 3-7.
REPORT AS OF: 01/07/86 BIN# SUPPLIER 0 H & S SURPLUS STOCK SHIP DATE INVENTORY AMOUNT 7391Z22F 5405T14F 6650D22S 8/13/85 9/11/85 12/05/85 $5,012.50 $12,129.60 $14,985.00 BIN TOTAL 1 ACME WIDGET BAY PAPER CO. CARDINAL MILLS JAKE'S JUNK $32,127.10 2457A11C 12/01/85 $553,477,666.95 7391Z22F 12/01/85 $4,704.00 5405T14F 11/28/85 $1,396.00 3739A14F 12/15/85 BIN TOTAL 2 ACME WIDGET CARDINAL MILLS ACME WIDGET H & S SURPLUS BIN TOTAL TOTAL INVENTORY * $1,189.32 $553,485,956.
REPORT REPORT - HEADER STATEMENTS Header statements are used to print report titles and column headings at the top of each report page. Syntax 2 2 H header number,print element,print position ,SPACE A number ,E number 33 2 2 ,SPACE B number 33 Z For example: H2,F-NAME,20,SPACE A5 Where header number = 2, print element = F-NAME, print position = 20, and number of spaces = 5 Parameters header number is an integer from 1 to 9.
REPORT Refer to Table 3-6 at the beginning of the REPORT command for descriptions of the other parameters. Discussion A header can contain up to 9 lines of information and any number of blank lines as long as it does not exceed the page size as de ned by the output control statement LINES=. (Refer to the description at the beginning of this section.) A report consisting of only header statements will not generate any output.
REPORT REPORT - DETAIL STATEMENTS Detail statements usually specify a data item name whose value changes with each data entry reported, although a xed series of characters can be speci ed as well. The statement speci es the print position, top-of-form, line spacing, and applicable edit masks.
REPORT The characters are printed without the surrounding quotation marks, and are printed once for each entry reported. Refer to Table 3-6 at the beginning of the REPORT command for descriptions of the other parameters. Discussion Negative data item values of type P, Z, I, J, and K are output with a special character in the rightmost position, unless you use the NOPUNCH output control statement. This type of output is called overpunch. Refer to the REPORT ALL command for more information on overpunch.
REPORT REPORT - EDIT STATEMENTS The edit statement is used for formatting data item values printed in a report. The statement performs such functions as suppressing leading zeros in numeric values, inserting characters such as dollar signs, dashes, commas, and decimal points. It also masks characters to eliminate them from the printed output. Edit statements can appear anywhere in the report.
REPORT DATA ITEM VALUE A34B ABCD EDIT MASK "X//X-X-X-X" "- - - X" PRINTED RESULT A//3-4-B-* ---A Numeric Edit Masks A numeric edit mask consists of the placement holders (9,Z,*,$), the sign characters (CR,-), and any other numeric ASCII printing characters used as insertion characters. Each of the place holders and sign characters serves a special purpose in editing data item values. Characters and their usage are speci ed in Table 3-7.
REPORT Table 3-7. Numeric Edit Mask Characters 3-108 CHARACTER EXPLANATION 9 Each 9 in the edit mask is replaced with a decimal digit from the data item value in the corresponding position of the output eld. Z Z is a zero suppression place holder. A Z in the edit mask is replaced with a decimal digit from the data item value in the corresponding position of the output eld.
REPORT Table 3-8.
REPORT These edit masks work the same way as for other data types except that the placement of the decimal point determines where the number will be placed in the eld. Note that xed R2 values occupy up to eight characters and oating-point R2 values occupy up to 12 characters. R4 values occupy up to 18 and 22 characters for xed and oating-point respectively. REAL VALUE TYPE 0 8399607 123456 .0034567 REAL VALUE DEFAULT REPORT OUTPUT R2 R2 R2 R2 0.00000 .839961E+07 123456. .
REPORT 5405T14F 4397D13P 3739A14F 6650D22S 6650D22S 6650D22S 9/11/85 3/02/85 12/15/85 12/05/85 12/14/85 12/15/85 REPORT - SORT STATEMENTS The sort statement speci es data items whose values are used to sort data entries when they are printed in the report. It also de nes control break levels for use by group and total statements in the report.
REPORT indicates that the data item values are to be ordered in descending order. DES The following sort statement sorts the entries into the order speci ed by the value of L-NAME.
REPORT control break WHITE WHITE ROB WILL 26 22 Control Breaks A control break occurs during the printing of a report whenever the value of a current entry for a data item de ned in a numbered sort statement is di erent from the value of the last entry. When the rst entry is printed, a control break occurs since the data item value changes from null (no value) to the rst value. Totals are not printed when the rst control break occurs.
REPORT Maximum Number of Sort Items The number of data items you can use to sort is limited in two ways. The maximum number of sort statements allowed in a single report is 66. You can have up to 66 sort statements provided that the combined length of the data items in all of the 66 statements is not greater than 2045 words.
REPORT REPORT - GROUP STATEMENTS A group statement prints the value of a data item, the value in a register (Rn ), or a series of characters whenever a control break occurs.
REPORT Discussion Each control break occurs as a result of a sort statement labeled from 1 to 10. When the control break occurs, the group statement with the same number as the sort statement prints the information you specify. (Refer to \Control Breaks" under REPORT Sort Statements for more information.) Whenever a control break occurs, all group statements with a number equal to or less than the level of the sort statement causing the break will print a value and/or series of characters.
REPORT 6650D22S 1 ACME WIDGET BAY PAPER CO.
REPORT Parameters level print element is the letter F or an integer from 1 to 10 corresponding to the level of a sort statement. The letter F indicates the information is to be printed only at the end of the report after the last detail line and it relates to the entire report, not just a subgroup. (1) is the name of a simple data item or a compound data item with an optional subscript parameter. Data items can be quali ed with the data base and data set which they belong.
REPORT Discussion If the total statement is labeled TF, the ADD, AVERAGE, and COUNT options apply to all occurrences of the data item in the report. Negative data item values of type P, Z, I, J, and K are output with a special character in the rightmost position, unless you use the NOPUNCH output control statement. This type of output is called overpunch. Refer to the REPORT ALL command for more information on overpunch.
REPORT BOBO'S MERCANTILE ON HAND INVENTORY BIN# SUPPLIER 0 H & S SURPLUS BIN TOTAL 1 STOCK SHIP DATE 7391Z22F 5405T14F 6650D22S 8/13/85 9/11/85 12/05/85 <------ ACME WIDGET BAY PAPER CO.
REPORT >MU ALL For example, given the following values in the data sets STOCK-DETAIL and SALES-DETAIL: STOCK-DETAIL -----------------------------STOCK# DESCR ON-HAND -----------------------------110 NUT 970 60 BOLT 1200 50 NAIL 1000 50 NAIL 900 ------------------------------ SALES-DETAIL -----------------------------ACCT# STOCK# QUAN -----------------------------666 90 350 222 60 25 999 60 500 555 60 75 333 50 45 111 50 100 ------------------------------ the following compound data set entries are creat
REPORT REPORT - REGISTER STATEMENTS A register statement speci es an operation to be executed in one of 30 QUERY registers. The register statements are executed sequentially as they appear in the REPORT command, once for each data entry in the report (that is, once for each entry selected by the last retrieval command).
REPORT SUBTRACT MULTIPLY DIVIDE NOREPEAT subtracts the data element from the contents of the register. multiplies the contents of the register by the data element . divides the contents of the register by the data element . can only be used if the REPORT command follows a MULTIFIND command. When NOREPEAT is used, the data element must be a data item name.
REPORT 3. Use an arithmetic operation that results in zero. For example: R4,SUBTRACT,QUANTITY (where QUANTITY is equal to the contents of R4) If you divide the contents of a register by zero, the result is zero. Results of integer division are truncated. Register and Data Types Only numeric type data can be used in register operations. The following IMAGE data item types are allowed: whole numbers or integers (I1,I2,I4,J1,J2,J4,K1,K2,Zn , and Pn ) real numbers (R2) extended precision real numbers (R4).
REPORT R1,ADD,"000000.0" R1,LOAD,"0.000000" R1,MUL,"1.000000" R1,ADD,"500.0000" R1,LOAD,".0000100" (produces 0.0) (produces 0.0) (produces 1.0) (produces 500.0) (produces .00001) The following will not perform the conversion since leading zeros will not a ect the output. R1,LOAD,"000005.0" R1,LOAD,"000000.5" (produces an R2 data type) (produces an R2 data type) However, the following will perform the conversion. R1,LOAD,"5.000000" R1,LOAD,".
REPORT >>H7,"INVENTORY",68 >>H8,"AMOUNT",68 >>D1,STOCK#,36 >>D1,LASTSHIPDATE,48 >>D1,R12,68,E1 >>E2,"XX/XX/XX" >>E1,"$$$,$$$,$$$,$$$.
REPORT JAKE'S JUNK 3739A14F 12/15/85 BIN TOTAL 2 ACME WIDGET CARDINAL MILLS $553,485,956.27 4397D13P 3/02/85 $55,080.00 3586T14Y 11/20/85 $358.56 BIN TOTAL 3 ACME WIDGET H & S SURPLUS * $55,438.56 * 6650D22S 12/03/85 $75,716.62 6650D22S 6650D22S 12/17/85 12/15/85 $187.85 $153.45 BIN TOTAL TOTAL INVENTORY $1,189.32 $76,057.92 accumulated R12 values--->$553,248,579.
REPORT 60 lines per page. Page advancing at the beginning of each report page. On the terminal, the page advancing appears as 6 line feeds. Output printed on the $STDLIST device (the terminal in session mode and line printer in job mode). No pauses while the report is being printed. If you are using the REPORT ALL command, these statements must precede the keyword ALL. Example In the following example, entries are located with the FIND command.
REPORT >>G1,"GROUP TITLE",11 >>END QUERY/V COMMANDS 3-129
REPORT ALL Prints data item values of entries located by the last retrieval command without formatting. Syntax 2 R EPORT 32 3 2 output control statement; ALL ,character 3 For example: >REPORT ALL,X Where character = X Parameters output control alter the standard output parameters. (Refer to the section on Output statements Control Statements under the REPORT command.) character is any printable ASCII character, except a minus sign (-).
REPORT ALL Table 3-9. REPORT ALL Options OVERPUNCH DATA ITEM USED NAMES PRINTED REPORT ALL Y Y REPORT ALL, X Y N REPORT ALL, - N Y COMMAND Overpunch Characters If the minus option is not used, QUERY prints negative values of type P or Z and positive values of type Z with a special character in the rightmost digit substituting for the minus or plus sign. This special character is called an overpunch character and varies according to the rightmost digit in the value.
REPORT ALL Table 3-11.
REPORT ALL 54283545 MAYFIELD WILLIAM 4CONTROL5 Y < CONTROL Y > When REPORT ALL is used with a character, the data values are printed without the data item names and data set names. You can terminate the report at any time by entering 4CONTROL5 Y.
REPORT procedure Executes a REPORT command stored as a procedure in the current Proc- le. Syntax 2 R EPORT 32 3 2 output control statements; procedure name ,character 3 For example: >REPORT REP4,J Where procedure name = REP4, character = J >R FINDTAX Where procedure name = FINDTAX Parameters output control statements procedure name character Refer to the section on Output Control Statements in the REPORT command. is the name of a REPORT command stored as a procedure in the current Proc- le.
REPORT procedure PROCEDURE: REP4 001 002 003 004 005 006 REPORT H1,"MONTHLY SHIPMENTS",25,SPACE A2 S1 STOCK,STOCK# G1,STOCK#,15 D1,LASTSHIPDATE,25 END Figure 3-10. REPORT Procedure Named SHIPMNTS When the procedure is executed. QUERY prints the o ending sort statement and prompts for a correction. Once you enter a correct statement or series of statements, execution of the procedure continues.
SAVE Creates an MPE le containing data from the the IMAGE data entries referenced in the current select le. Syntax 2 SA VE 3 2 lename /lockword 3 Parameters lename lockword is the MPE lename by which the saved select le is known. is the lockword that will be associated with the saved select le. Discussion The SAVE command creates a new MPE le containing the IMAGE data entries selected by the most recent retrieval command.
SETLOCKS SETLOCKS Prevents automatic unlocking of a data set. Syntax 2 SET LOCKS 3 Discussion The SETLOCKS command prevents the automatic unlocking of a data set after a retrieval, update, or REPORT command has been executed. Normally, QUERY locks a data set while these commands are executing, but not in the interim between commands. By issuing the SETLOCKS command, you can lock the data set during the time between commands.
SHOW Displays the current state of an aspect of the QUERY environment. Syntax 3 2 9 8 data base name DBLIST > > 3 2 > > = 2 3< JOIN data base name 3 2 SH OW data base name > LOCKOPTION > > > 2 3 ; : LANG UAGE Parameters DBLIST JOIN LOCKOPTION LANGUAGE data base name shows the contents of the data base list. (Refer to the DBLIST= command). shows the most recent valid JOIN command, if any. shows the current state of LOCKOPTION which can be reset with the ASSIGN command. is the user language.
SUBSET SUBSET Retrieves entries from a select le. Syntax 2 SUB SET AND OR 32 #LIMIT=i 3 relation 2 3 "pattern" item identi er M ATCHING relation 2 3 item identifer M ATCHING "pattern" 2 . . . END 3 Parameters i is an integer specifying the maximum number of qualifying entries you want to retrieve. When the #LIMIT parameter is speci ed, only the rst i qualifying entries are placed in the select le.
SUBSET relop is a relational operator as shown in Table 3-10. value is the data item value. It must be the same type and within the same value range as the data item named in the relation . Value need not be enclosed in quotation marks unless the value contains special characters. A value which is not contained in quotation marks is upshifted. For example, California is converted to CALIFORNIA before it is compared to data item values in the data base.
SUBSET Example >FIND PERIODICAL.JOURNAL="LIFE SCIENCES" >SUBSET PERIODICAL.YEAR=85 >SAVE MFILE In the example above, the SUBSET command only searches those entries that quali ed from the FIND command. The SAVE command saves entries from the current select le as a permanent le named MFILE.
SUBSET procedure Executes a SUBSET procedure stored in the current Proc- le. Syntax 2 2 3 SUB SET procedure name ,character 3 For example: >SUBSET ACCT Where procedure name = ACCT >SUB USERS,X Where procedure name = USERS, character = X Parameters procedure name character is the name of a SUBSET command previously stored as a procedure using the CREATE command.
TRANSBEGIN TRANSBEGIN Marks the beginning of a logical logging transaction. Syntax 2 T RANSBEGIN 32 32 data base name: "text" 3 Parameters data base name is the name of a currently open data base. If no data base name is speci ed, the transactions are logged against the data base opened with the DEFINE or DATA-BASE= command. is an optional character string to be written to the log le. It can contain any information that you might want to include about the transaction.
TRANSEND Marks the end of a logical logging transaction. Syntax 2 TRANSE ND 32 32 data base name: "text" 3 Parameters data base name "text" is the name of a currently open data base. If no data base name is speci ed, the transactions are logged against the data base opened with the DEFINE or DATA-BASE= command. is an optional character string to be written to the log le. It can contain any information that you might want to include about the transaction.
TRANSMEMO TRANSMEMO Allows a message to be written to the log le. Syntax 2 TRANSM EMO 32 32 data base name: "text" 3 Parameters data base name "text" is the name of a currently open data base. If no data base name is speci ed, the message is logged against the data base opened with the DEFINE or DATA-BASE= command. is a character string to be written to the log le.
UNDO Restores the previous select le. Syntax 2 UN DO 3 Discussion The UNDO command clears the last SUBSET retrieval and returns you to the previous level of data retrieval. Each group of retrieved entries is stored in a temporary internal le known as a select le. Entering the UNDO command removes the last group of retrieved entries (select le) and restores the previous group of retrieved entries as the current select le.
UPDATE ADD UPDATE ADD Adds data entries to a manual master or detail data set. Syntax 2 3 U PDATE ADD, 2 3 AD D 2 3 data base name: data set name For example: >UPDATE ADD,LABOR Where data set name = LABOR >AD PAYROLL Where data set name = PAYROLL Parameters is the name of a data base speci ed in either the DEFINE, DATA BASE=, or data base MULTIDB command. name data set name is the name of a data set in the data base. The data set must be either a manual master or detail.
UPDATE ADD However, if you try to use 4RETURN5 for a search item, QUERY will prompt you again for the value. The command is terminated with two slashes. If you are in session mode and enter a value that is too large or that contains invalid characters, QUERY issues an error message and reprompts with the same data item name. If illegal data is encountered while QUERY is running in a job or from an XEQ le, QUERY will issue an error message and stop adding data. In job mode, QUERY will also terminate.
UPDATE ADD "ROBERT ""BOB"" BRUN" Numeric type values (all types except U and X) are always right-justi ed whether entered with or without quotation marks. Numbers entered in X type data items are always left-justi ed. Null Values Only search and sort items must have values supplied. If you do not want to enter a value for other items, you can enter a null value. In session mode press 4RETURN5 without any preceding characters. In job mode, supply a blank line to indicate a null value.
UPDATE ADD Example In the example below, the user tries to add an account to the SALES detail data set, but the account is not already in the CUSTOMER master data set. QUERY prints an error message and reprompts for data item values. The command is terminated with two slashes. Next, the account is added to the CUSTOMER master data set. The original entry can then be added to the SALES detail data set. Note that dates are automatically added to the DATE-MASTER automatic master data set.
UPDATE DELETE UPDATE DELETE Deletes data entries from a data set. Syntax 2 3 U PDATE DELETE 2 3 DEL ETE Discussion This command is an extension of a retrieval command in that it deletes those entries selected by the previous retrieval command. All of the entries must reside in the same data set. UPDATE DELETE may only be used following the FIND or FIND ALL command or SUBSET command following a FIND or FIND ALL command.
UPDATE DELETE > In this example, there is a detail data entry in SALES with an ACCOUNT value of 07954001, so QUERY will not delete the entry from the CUSTOMER master data set. Next, an entry with an ACCOUNT equal to 07954001 is deleted from the SALES detail data set. Now the ACCOUNT equal to 07954001 in the CUSTOMER master data set can be deleted.
UPDATE REPLACE UPDATE REPLACE Modi es the value of data items. Syntax 2 3 3 2 U PDATE REPLACE, 2 3 data item name (subscript) = "value"; REPL ACE , 2 3 3 2 data item name (subscript) = "value"; . . .
UPDATE REPLACE X OF Y ENTRIES REPLACED X is the number of entries that were successfully updated, and Y is number of retrieved entries. Session Mode When you enter an UPDATE REPLACE command from a terminal, QUERY checks each line of the command as it is entered. If an error occurs, the line is ignored, an error message is sent, and you are prompted for another line. QUERY continues to prompt for lines until you enter END. END is required.
UPDATE REPLACE Examples Example 1 >F CUSTOMER.FIRST-NAME=GENEVA USING SERIAL READ 1 ENTRIES QUALIFIED >REPL,STREET-ADDRESS="868 DOYLE ROAD"; >>END >LIST CUSTOMER FOR FIRST NAME=GENEVA ACCOUNT LAST-NAME 10034764 SLATER FIRST-NAME GENEVA IN STREET-ADDRESS 868 DOYLE ROAD In example 1, the CUSTOMER entry with FIRST-NAME of GENEVA is located. The street address is changed. The LIST command is used to check the results.
UPDATE REPLACE In example 3, REPORT ALL is used to verify the replacements. The entries are still available from the last FIND. Each PRODUCT data set entry with a STOCK# greater than 70000000 is changed so that the description is OBSOLETE.
UPDATE procedure UPDATE procedure Executes an UPDATE command stored as a procedure in the current Proc- le. Syntax 2 2 3 U PDATE procedure name ,character 3 For example: >UPDATE UPDNAMES Where procedure name = UPDNAMES >U CHANGE,% Where procedure name = CHANGE and character = % Parameters procedure name character is the name of an UPDATE ADD, UPDATE REPLACE, or UPDATE DELETE command procedure in the current Proc- le. is any printable ASCII character.
UPDATE procedure END When using null values, QUERY prompts for values when the procedure is executed.
VERSION VERSION Displays the current version of QUERY and IMAGE procedures and utilities. Syntax 2 V ERSION 3 Discussion This command will print the current version, update, and x level information for QUERY and all IMAGE procedures and program les on the standard list device. If OUTPUT=LP has been speci ed previously, the information is also printed on the QSLIST device. (Refer to the OUTPUT= command for a description of QSLIST.) >VERSION QUERY C.00.08 IMAGE PROCEDURES: DBOPEN C.0A.16 DBINFO C.00.
XEQ Executes QUERY commands from a le instead of the standard input device. Syntax 2 3 2 lename ,NODATA For example: X EQ 3 XEQ CFILE,NODATA Where lename = FILE and option = ,NODATA Parameters lename NODATA is the name of an ASCII le containing commands and parameters. if speci ed, QUERY prompts for null data values and any command parameters when the XEQ le is executed.
XEQ If you enter 4CONTROL5 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 le, 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 4CONTROL5 Y. The following is an example of an XEQ le which will create an execution loop.
XEQ 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.22 Figure 3-11. Billing Report From an XEQ File The XEQ le PRXFIL contains: FIND CHAIN CUSTOMER.ACCOUNT,SALES.ACCOUNT="" END REPORT BILL Since 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.
XEQ TF,"TOTAL DUE",9,SPACE B2,SKIP A TF,R0,70,E2 S,PURCH-DATE END QUERY/V COMMANDS 3-163
A QUERY/V MESSAGES The messages in this appendix are listed alphabetically. Messages that begin with a number are listed alphabetically, with the other messages, by the rst word after the number. For example, the message: x ENTRIES QUALIFIED is listed with the messages beginning with the letter E. MESSAGE MEANING The same dummy data set can only be used in one data set equivalence. A FILE WITH THE GIVEN NAME There is already a le with the ALREADY EXISTS same name in the speci ed group and account.
MESSAGE MEANING ACTION ARITHMETIC OVERFLOW [ON Rn ] The sum of data item values The REPORT command terminates. Re-enter the command or alter the report procedure and execute it again. ATTEMPTED HEAD Delete the detail entries, then delete the master entry. ATTEMPTED SEARCH OR ATTEMPTED READ-ONLY AUTOMATIC being totaled (using a Total statement ADD option) exceeds 20 digits. A register arithmetic operation caused an under ow/over ow condition on the speci ed register number n .
MESSAGE MEANING This is an internal QUERY problem. BAD MODE This is an internal QUERY problem. BAD PASSWORD Password not de ned for data base. You cannot access any data items or data sets. BEGINNING OF CHAIN This is an internal QUERY problem. BEGINNING-OF-FILE This is an internal QUERY problem. BROKEN CHAIN POINTERS You have read only access and are sharing the data base with a user who is making structural changes to it.
MESSAGE CANNOT DELETE ENTIRE COMMAND CANNOT FIND SEARCH STRING IN COMMAND HISTORY BUFFER CANNOT USE SUBSET COMMAND AFTER A FIND CHAIN COMMAND CHARACTER TYPE DATA ITEMS MAY ONLY BE EQUATED WITH CHARACTER TYPE DATA ITEMS COMBINED LENGTH OF DATA ENTRIES FORMING A COMPOUND ENTRY CANNOT EXCEED 2047 WORDS COMMAND STOPPED AT LIMIT, AS SPECIFIED COMMAND TABLE OVERFLOW x COMPOUND ENTRIES QUALIFIED A-4 QUERY/V MESSAGES MEANING ACTION You cannot completely delete a command from the command history bu er.
MESSAGE CONSTANT LITERAL TABLE OVERFLOW CONTROL BREAK INCONSISTENCY COUNT OPTION ALREADY SPECIFIED COUNT OPTION NOT ALLOWED IN STATEMENT DATA BASE data base name HAS BEEN CLOSED, COMMAND CANNOT BE CONTINUED MEANING LIST: Number of data item values appearing in the entire LIST command has exceeded the capacity of the table used to hold them.
MESSAGE MEANING The data base name is invalid, or the account or group speci ed does not exist, or you do not have access to that data because of MPE security. DATA BASE CANNOT BE OPENED The data base cannot be opened (DBOPEN DID NOT SUCCEED) because an error occurred. DATA BASE IN USE The data base is currently being accessed and cannot be opened with an exclusive access mode.
MESSAGE DATA ITEM NOT RETRIEVED data item name DATA ITEM USED IN MATCH MUST BE TYPE "U" OR "X" DATA ITEM VALUE TOO LONG DATA OF TYPE K CANNOT BE A NEGATIVE VALUE DATA SET BUSY - TRY AGAIN DATA SET FULL DATA SET NOT WRITEABLE DBB CONTROL BLOCK FULL MEANING ACTION The command references a data item that was not previously selected by a retrieval command. The data item speci ed for a pattern match must be of character type.
MESSAGE DBU CONTROL BLOCK FULL DELETE ALL RETRIEVED ENTRIES (YES OR NO)? DIRECTED BEGINNING-OF-FILE DIRECTED END-OF-FILE DIRECTORY OVERFLOW, PROCEDURE REJECTED DUPLICATE EDIT STATEMENTS DUPLICATE ITEM IGNORED item name DUPLICATE ITEM NAME MEANING Close and reopen the data base you are accessing either by exiting and re-entering QUERY or by using the CLOSE command. If the problem persists, refer to the IMAGE Reference Manual for an explanation of the problem.
MESSAGE MEANING The procedure name already exists in the current Proc- le. DUPLICATE SEARCH ITEM VALUE You have entered a search value that already exists in the master data set. The value you tried to add is ignored. DUPLICATE SORT DATA ITEM More than one sort statement NAME contains the same data item name, quali ed with the same data base name and subscript. EDIT MASK ERROR A numeric edit mask contains characters in the wrong order.
MESSAGE END-OF-FILE ON COMMAND INPUT FILE END-OF-FILE ON REPORT FILE END OF XEQ FILE END PRINT POSITION ERROR END PROCEDURE DATA x ENTRIES HAVE QUALIFIED, DO YOU WANT TO CONTINUE SEARCHING? x ENTRIES NOT DELETED BECAUSE CORRESPONDING DETAIL ENTRIES EXIST x ENTRIES QUALIFIED EOD ON COMMAND INPUT FILE A-10 QUERY/V MESSAGES MEANING QUERY has encountered the end of the input le before nding an EXIT command. In batch, the end of le could be caused by a :EOD, :EOJ, :JOB or :DATA record.
MESSAGE MEANING An internal error occurred while trying to process the pattern speci ed with MATCHING. There may be too many characters in the pattern. Internal QUERY Problem. Item ERROR IN SAVE PROCEDURE # n is the number of the item in INVALID ITEM BOUNDARIES error. ITEM # n Internal QUERY Problem. Item ERROR IN SAVE PROCEDURE INVALID ITEM LENGTH - ITEM # n is the number of the item in error. # n Internal QUERY Problem.
MESSAGE ERROR IN SAVE PROCEDURE ITEM NAME CONTAINS INVALID CHARACTER - ITEM # n ERROR IN SAVE PROCEDURE ITEM NAME IS ALL BLANKS ITEM # n ERROR IN SAVE PROCEDURE NUMBER OF ITEMS MUST BE GREATER THAN ZERO EXPECTED A " , " EXPECTED A " .
MESSAGE MEANING ACTION The value in quotes is missing or If prompted with >>, re-enter the beginning or ending quote is the data item name and value. Otherwise, correct the command missing. and re-enter it. Correct the command and EXPECTED A LEFT PARENTHESIS The left parenthesis which speci es a sub-item index is re-enter it. missing from the command. Correct the command and EXPECTED A RIGHT The right parenthesis which speci es a sub-item index is re-enter it. PARENTHESIS missing from the command.
MESSAGE MEANING FILE OPEN ERROR code A le error occurred while opening a le. Code is an MPE le system error number. FILE READ ERROR code A physical error occurred during Proc- le read operation. Code is an MPE le system error number. FILE SYSTEM ERROR OCCURRED A le error occurred while IN SDBUILD INTRINSIC - code QUERY was saving the select le. Code is an MPE le system error number. FILE WRITE ERROR code A physical error occurred during le write operation. Code is an MPE le system error number.
MESSAGE FULL MASTER FOR item name IN MASTER set name FWRITEDIR FAILURE x, y FWRITELABEL FAILURE x, y HEADERS OVERFLOW A PAGE ILLEGAL ACCESS ILLEGAL ASCENDING/DESCENDING CODE MEANING An attempt has been made to add a detail data entry with a search item value that does not match any existing search item value in the corresponding automatic master set name and a new master entry cannot be created because the automatic master data set is full. Item name is the detail data set search item name.
MESSAGE MEANING ACTION ILLEGAL DATA ITEM NAME item The data item named item name Use the MULTIDB command to name ILLEGAL DATA SET NAME set name ILLEGAL DATA TYPEitem name does not belong to the data base currently being accessed, is not accessible to you based upon your password, or is not a member of the data set speci ed in the fully-quali ed data item name.
MESSAGE ILLEGAL NAME ILLEGAL PROCEDURE NAME ILLEGAL REGISTER OPERATOR ILLEGAL SOURCE DIGIT IN CONVERSION CVAD - REPLACED WITH ZERO ILLEGAL SELECTION CRITERIA ILLEGAL UPDATE TYPE MEANING ACTION ALTER, CREATE, DESTROY, DISPLAY, RENAME: The referenced procedure name exceeds eight characters, contains illegal characters, or consists of a reserved word. Refer to the CREATE command for naming rules or use DISPLAY LIST to determine the correct procedure name. Re-enter command with correct name.
MESSAGE MEANING ACTION The statement contains an edit Revise the statement and re-enter command. statement label not used to de ne an edit statement. IN ORDER TO SAVE A COMPOUND The select le may not be saved None SELECT FILE, THE NUMBER OF since there are too many data items in the compound entry. DATA ITEMS THE COMPOUND INCONSISTENCY BETWEEN OPTION AND EDIT STATEMENTS ENTRY POSSESSES MUST BE LESS THAN 511.
MESSAGE MEANING ACTION Shorten the statement and ALTER: Combined length of continued lines (connected by &) re-enter the command. exceeds 250 characters. Re-enter the command with GENERAL: Command exceeds fewer characters if possible. 698 characters. Re-enter the value. FIND, MULTIFIND, SUBSET, None UPDATE: Data item value is longer than the maximum length for the data item. INSUFFICIENT VIRTUAL MEMORY QUERY cannot obtain necessary Try again later.
MESSAGE MEANING ACTION Refer to the EDIT command in Section 3 for information on the valid subcommands. INVALID FILE NAME GIVEN The le name speci ed must be Refer to Using the HP 3000 for a description of legal le names. a legal MPE le name. If prompted, enter a valid mode, INVALID MODE The response to the MODE= prompt is not an integer from 1 or re-enter the command with a valid mode. to 8.
MESSAGE LANGUAGE NOT CONFIGURED ON THIS SYSTEM. NATIVE-3000 USED LEVEL ERROR LIMIT MUST BE POSITIVE LITERAL EXPECTED LITERAL TOO LARGE LINE WOULD EXCEED MAXIMUM OF 70 CHARACTERS. BREAK LINE FIRST LOGICAL CONNECTIONS ARE INCOMPLETE; COMPOUND DATA SET CANNOT BE GENERATED LOGGING ENABLED AND NO LOG PROCESS RUNNING LOGGING NOT ENABLED FOR THIS USER MATCH NOT VALID WHEN LANGUAGE <> NATIVE-3000 MAXIMUM NUMBER OF DATA BASES (10) ALREADY OPEN MEANING Languages are con gured on each system.
MESSAGE MEANING Command tried to add an entry to a detail data set linked to the name speci ed master data set without a corresponding entry in the master data set for the search item value. Item name is the detail data set search item and set name is the master data set name. MISSING SEARCH OR SORT ITEM Internal QUERY problem.
MESSAGE MEANING NO DATA BASE WITH THE GIVEN The speci ed data base name is NAME IS CURRENTLY OPEN invalid or not currently open. NO ENTRY NO COMMAND TO EDIT NO FILE NAME GIVEN NO RECORDS HAVE BEEN RETRIEVED YET - SUBSET COMMAND NOT ALLOWED NO RECORDS TO REPORT NO RETRIEVAL WAS MADE FROM DATA BASE data base name , WHICH WAS NAMED IN A USER PROCEDURE No entries match the selection criteria. The command history bu er is empty. A le name was expected in the command.
MESSAGE NON-NUMERIC DIGIT ENCOUNTERED NON-NUMERIC IN REAL VALUE MEANING The value entered contains an illegal character. The value entered for a data item type real contains an illegal character, or the value is larger than the maximum allowed for the data type. (This does not include scienti c notation.) The referenced procedure does not contain a FIND command. ACTION Enter the correct value. Refer to Section 1 for information on data item types and ranges. Re-enter the command with a correct value.
MESSAGE NOREPEAT MAY ONLY BE ASSOCIATED WITH UP TO 10 SORT LEVELS AND/OR REGISTERS NOREPEAT OPTION ALLOWED ONLY IN REGISTER OR TOTAL STATEMENTS NUMBER SPECIFIED IS TOO LARGE/SMALL FOR DATA ITEM TYPE x NUMERIC EDIT MASK EXCEEDS 20 CHARACTERS NUMERIC VALUE ERROR or NUMERIC VALUE ERROR ITEM IGNORED ||ALTER, DISPLAY: A line number contains too many digits or an illegal character. ||Re-enter the statement or command with the correct line number.
MESSAGE MEANING ACTION A syntax or spelling error has occurred. PASSWORD DOES NOT MATCH ANY The password was typed DEFINED FOR SPECIFIED DATA incorrectly. Revise the statement and re-enter the command. Re-type the password. The password contains more than eight characters or does not allow at least read access to the data base. PROCEDURE CANNOT BE DELETED You have attempted to delete a procedure, line by line, using BY ALTER ALTER. The procedure is not changed and the ALTER command terminates.
MESSAGE MEANING The le being declared as the Proc- le is smaller than ve records. 'QSLIST' DEVICE NOT The device de ned as QSLIST is AVAILABLE in use by another process. QUERY IS NOT ALLOWED TO The data base administrator has ACCESS THIS DATA BASE disallowed all access to this data base. QUERY IS NOT ALLOWED TO The data base administrator has MODIFY THIS DATA BASE - USE disallowed all write access to this data base.
MESSAGE MEANING Some of the data items selected by the retrieval command may have been deleted by some other user prior to executing the REPORT command. REQUESTED ACCESS MODE IS The data base is currently being UNAVAILABLE accessed in an access mode which is incompatible with the one speci ed. RETRIEVAL FROM MORE THAN The LIST or FIND command ONE DATA SET has speci ed access to more than one data set or the FIND CHAIN command has speci ed access to more than one detail data set.
MESSAGE MEANING ACTION Enter RELEASE to cancel the locks already in e ect. If RELEASE is not entered, any RELEASE command. new locks will be held along with any locks already in e ect. SETLOCKS COMMAND WAS NOT IN SETLOCKS was not previously None entered. EFFECT Revise the statement and SKIP OPTION ALREADY The SKIP option has been re-enter the command. SPECIFIED speci ed twice in the same statement.
MESSAGE MEANING ACTION Correct the le equate (refer to The le named in the SAVE command must have an SDFILE Appendix G for SAVE le lecode. speci cations) or use another le name. SPECIFIED FILE HAS The le named in the SAVE Correct the le equate (refer to INCOMPATIBLE RECORD SIZE command has an incorrect Appendix G for SAVE le (CHECK FOR FILE EQUATE) record size. speci cations) or use another le name.
MESSAGE MEANING ACTION STATUS= %XXXXXX P=%XXXXXX TRAP=%XXXXXX Consult with the system manager. SUB-ITEM GREATER Correct the sub-item index and re-enter it. Use the FORM command to check the number of sub-items for that data item. SUB-ITEM A hardware trap has occurred which cannot be handled by QUERY. (May be caused by hardware failure.) QUERY terminates. XXXXXX is an octal number. STATUS is the status register, P is the P-register and TRAP is the MPE trap number.
MESSAGE THE DATA SET data set name , NAMED IN A USER PROCEDURE, IS NOT IN DATA BASE data base name . MEANING The data set speci ed in the user procedure does not belong to the data base speci ed, or is not accessible to you based upon your password. THE DATA SET data base name: A data set named in the data set name WAS NOT NAMED MULTIFIND or SUBSET of a MULTIFIND must have been IN THE MOST RECENT JOIN speci ed in the most recent COMMAND JOIN command.
MESSAGE MEANING ACTION TOO MANY DATA ITEM There can only be up to 53 data Decrease the number of equivalences and re-enter the EQUIVALENCES WERE SPECIFIED item equivalences. TOO MANY DATA SET EQUIVALENCES WERE SPECIFIED; JOIN EXPECTED UNABLE TO ACCESS DATA BASE IN THIS MODE, m, n UNABLE TO USE FILE name ||The requested new Proc-file name is not large enough or is not an empty existing Proc-file. ||Re-enter the command with a different name .
MESSAGE USER LANGUAGE INVALID USER LANGUAGE NOT CONFIGURED ON THIS SYSTEM. NATIVE-3000 USED. USING SERIAL READ USING SORT/MERGE WARNING: LOCKS ARE BEING HELD WHAT IS THE VALUE OF item name WRITE ERROR TO COMMAND LISTFILE MEANING User language not available. Only NATIVE-3000 is available on your system. Languages are con gured on each computer system. Language speci ed is not available on your system. The default language is NATIVE-3000.
B QUERY/3000 SPECIFICATIONS LIMITS USED BY QUERY Table B-1. General TYPE MAXIMUM Data Base Name Number of Open Data Bases Password Length Record Size of Output Device Size of Data Item Value Size of Input Line 6 characters (excluding group and account) 10 8 characters 68 words 500 characters (250 words) 698 characters Table B-2. JOIN Command TYPE MAXIMUM Length of Dummy Data Set Name Number of Data Item Equivalences Number of Data Sets in JOIN 16 characters 52 53 Table B-3.
Table B-5.
Table B-9. Updating Command (UPDATE ADD and UPDATE REPLACE) TYPE MAXIMUM REPLACE or ADD Entry 2048 words (IMAGE maximum) FILES USED BY QUERY Table B-10. Files Equated by the User FILE NAME DESCRIPTION The le opened by QUERY for input. Opened as a new le. Can only be redirected on QUERY versions C.00.00 and later. The le opened by QUERY for output. Opened as a new le. Can only be redirected on QUERY versions C.00.00 and later. The output device speci ed when OUT=LP.
Table B-12. Files Created by the User and/or Specified to be Built by QUERY FILE NAME PROC-FILE DESCRIPTION Contains the procedures that may be used for executing certain QUERY commands. Opened as an old le. Required File Attributes: le code 1070, ASCII, rec size 128 words le size must be at least 5 records and not more than 400 records. SAVE FILE QUERY will build the le with 126 records. Note that most commands, with the exception of large reports, will require only one record.
C ACCESSING A REMOTE DATA BASE If you want to use QUERY to access a data base that resides on a remote HP3000, there are three methods available using Distributed Systems (DS/3000) and/or Network Services (NS/3000). Included in this section is information on both DS and NS. Either of these services can be used in Methods 1 or 2. Refer to the note in Method 3 for restrictions when using a data-base-access le.
Figure C-1. Using Method 1 METHOD 2: QUERY ON LOCAL SYSTEM The second method is similar to Method 1 except QUERY is run on the local system. First a :FILE command is used to specify the location of the remote data base. After initiating execution of QUERY, you specify the data base name with the DEFINE or DATA BASE= command. The name of the data base must be the same as the name speci ed as the formal le designator in the :FILE command. Figure C-2 illustrates Method 2 using DS.
Figure C-2. Using Method 2 When using NS, you must have previously issued a :FILE command specifying the remote location of the le, to access a remote data base and run QUERY. In the example above, the user would enter: :HELLO USERL.ACCTL :DSLINE SYSR :FILE DBR=DBX:SYSR :REMOTE HELLO MEMBER.PAYROLL :RUN QUERY.PUB.
METHOD 3: USING A DATA-BASE-ACCESS FILE The third method uses a data-base-access le to de ne the remote data base. When using the DEFINE or DATA-BASE= command, you enter the name of a data-base-access le rather than a data base name. Refer to the IMAGE Reference Manual for information on creating a data-base-access le. In this method, QUERY automatically issues a REMOTE BYE and closes the DSLINE when you enter the QUERY EXIT command. Figure C-3 illustrates Method 3 using DS.
Note IMAGE veri es the content of the data-base-access le and will accept only the DS syntax for the :DSLINE and :FILE commands. This is due, in part, to the IMAGE restriction on the size of the dsdevice name to 8 characters. If you are using NS, input the device class name or logical device number in the rst two records of the data-base-access le.
D NATIVE LANGUAGE SUPPORT Native Language Support (NLS) features can be accessed in QUERY to retrieve data which meet user-de ned selection criteria, and to sort data according to native language collating sequences. The user must know what the user language in QUERY is, how the language is speci ed, how the language a ects the output, and how to determine which language is being used. IMAGE data bases have a language attribute that describes the collating sequence used in sorted chains and locking.
upshifting, collating, range selection, formatting, or sorting is dependent on the QUERY user's language speci ed by the user via the JCW NLUSERLANG or the LANGUAGE= command. EFFECTS OF NLS ON QUERY NLS can a ect QUERY in upshifting data, range selection, data format, real number conversions, and sorted lists and numeric data editing in REPORT. Upshifting Data (Type U Items) QUERY upshifts commands and the data of type U items. QUERY commands are upshifted according to NATIVE-3000.
E SELF-DESCRIBING FILES A self-describing le is created when the SAVE command is executed. A le is considered to be self-describing when the user labels contain information about the format of the le. A self-describing (SD) le is composed of two or more user labels and data. FILE DATA Each record in the le holds an IMAGE entry that quali ed from a FIND or MULTIFIND retrieval.
Labels are in \reverse" order in the le. That is the last label is the global information label, the second to last label is the rst item description label. An item description label contains one or more item descriptions and there must be at least one item description label. When the le is built, space is reserved for pre-existing user labels. Pre-existing labels may have been placed in the le by an application program.
10 = IMAGE compound item The item types in parentheses correspond to IMAGE data types. Note: Type 2 refers to ASCII representations of numbers in free format. This includes 20, 45.7, 1.002E-10, -201.45. item o set is the o set of the item in the le record in bytes. This o set is relative to the beginning of the beginning of a record where the rst byte has an o set of zero, the second has an o set of one, and so on. (integer) item length is the length of the item in bytes.
and the following FIND and SAVE commands: >FIND STATE=2 OR STATE=3 USING SERIAL READ 4 ENTRIES QUALIFIED >SAVE SAVEFILE the SD le, SAVEFILE, appears as follows: -----------------------------| labels 0-9 | -----------------------------| item description label | -----------------------------| global information label | -----------------------------| | | data | | | ------------------------------ where the global information label contains: (version) (length) (#items) (#labels) (#items/label) (size) ---------
NAME, U10; OCCUP, U16; CITY, U10; STATE, I1; NAME2, U10; OCCUP2, U16; CITY2, U10; SETS: NAME: SET1, D; ENTRY: NAME, OCCUP, CITY, STATE; CAPACITY: 11; NAME: SET2, D; ENTRY: NAME2, OCCUP2, CITY2, STATE; CAPACITY: 11; END. and the following JOIN, MULTIFIND, and SAVE commands: >JOIN SET1.STATE TO SET2.
| OCCUP | 1 | 10 | 16 | 0 | -------------------------------------------------------| CITY | 1 | 26 | 10 | 0 | -------------------------------------------------------| STATE | 3 | 36 | 2 | 0 | -------------------------------------------------------| NAME2 | 1 | 38 | 10 | 0 | -------------------------------------------------------| OCCUP2 | 1 | 48 | 16 | | -------------------------------------------------------| CITY2 | 1 | 64 | 10 | 0 | -------------------------------------------------------- and the data i
F USER-DEFINED PROCEDURES Procedures This appendix documents a feature of the QUERY subsystem which is used primarily by the programmer or data base administrator. QUERY allows you to specify your own procedure(s) which will enable a report to read or write from another data base, data set, or le, modify registers, or perform other specialized tasks not provided by QUERY. The name of the user-de ned procedure cannot be the name of any data item in the data sets referenced by the retrieval command.
EDIT masks ADD AVERAGE COUNT If you specify an option that is not allowed, QUERY will issue the following message. A SPECIFIED OPTION IS NOT ALLOWED FOR USER PROCEDURES There are eight parameters that you can set. These are: CALLAGAIN, PAGE'EJECT, LINEBUF, REGARR, USERSTOR, USERPARAM, DATA'BASE'NAME, and DATA'SET'NAME. The other nine parameters are values returned by QUERY.
DBBUF Each name is preceded by the BASE'ID number (1 word) assigned by IMAGE. is an array which holds the values of the data items to which you have access for a speci c data set for the current entry or compound entry being output. The values of the data set are placed in DBBUF as follows: If the FIND command, or a SUBSET of a FIND command, was used to select the entries for reporting, then the data set that the FIND or SUBSET command referenced will be used.
The section on registers in the REPORT command description explains how QUERY determines the type of a register. *USERSTOR is a global scratch area for user data which is shared by all of your procedures that are referenced in any one report. Not initialized. *USERPARAM is where the value of your parameter is stored. One use of this parameter might be to indicate where in the output bu er to place the value. (For example, D1,PROC,/;D1,PROC (20),/; . . .
Examples The following examples show two user-de ned procedures: MPROC and QPROC. MPROC is shown in four languages and QPROC is shown in two languages. MPROC Procedure The following examples show MPROC in SPL, COBOL, PASCAL and FORTRAN. The data base, retrieval, and report are shown for understanding the context of the use of the procedure.
D1,ACCT-NUM,8,E1 D1,":",9 D1,DEPT,14 D1,CARRIER,65 D1,MPROC,/ G2," ",5 E1,"XXX-XXX" END The output is: REPORT ON ALL ACCOUNT DATES ACCOUNT DEPT ------- ---010-666: 010-666: 010-666: 010-666: 010-666: 010-666: 010-666: 010-666: 010-666: 008 008 008 008 008 008 008 008 008 DATE OF ORDER ------------WED, WED, WED, WED, WED, WED, WED, WED, WED, DEC DEC DEC DEC DEC DEC DEC DEC DEC 5, 5, 5, 12, 12, 12, 26, 26, 26, 1984 1984 1984 1984 1984 1984 1984 1984 1984 SHIPPING DATE ------------THU, THU, THU, THU, TH
LOGICAL CALLAGAIN, PAGE'EJECT; INTEGER ARRAY BASE'IDS, DBBUF, DSET'LIST, DATA'BASE'LIST, LINEBUF, REGARR, USERSTOR, USERPARAM, DATA'BASE'NAME, DATA'SET'NAME; INTEGER CALL'NUM, LINES'LEFT, PAGENO, NUM'DSETS, NUM'DBASES; BEGIN BYTE ARRAY FMTDATE (0:16), BLINEBUF (*) = LINEBUF; DOUBLE POINTER D'DATE; DOUBLE ARRAY D'DAY (0:0), D'YEAR (0:0); INTEGER ARRAY DAY (*) = D'DAY, YEAR (*) = D'YEAR; DOUBLE HOLD; INTEGER JDATE; INTRINSIC FMTCALENDAR; <<-------------------------------------------------------->> << THERE AR
<< THE SHIP-D DATA SET TO FORMAT THE SHIPPING DATE. >> <<-------------------------------------------------------->> IF CALL'NUM = 1 THEN << ORDER-D DATA SET >> BEGIN MOVE BLINEBUF(18) := FMTDATE, (17); MOVE DATA'BASE'NAME := "ACCTS "; MOVE DATA'SET'NAME := "SHIP-D "; CALLAGAIN := TRUE; END ELSE << SHIP-D DATA SET >> BEGIN MOVE BLINEBUF(38) := FMTDATE, (17); CALLAGAIN := FALSE; END; END; END. COBOL - MPROC Procedure $CONTROL USLINIT, SUBPROGRAM, MAP, DYNAMIC IDENTIFICATION DIVISION. PROGRAM-ID. MPROC.
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 05 BASE-ID1 PIC S9(4) COMP. 05 BASE-NAME1 PIC X(24). 05 BASE-ID2 PIC S9(4) COMP. 05 BASE-NAME2 PIC X(24). 05 BASE-ID-OTHERS PIC X(208). DBBUF PIC X(4102). DBBUF-2 REDEFINES DBBUF. 05 FILLER PIC X(6). 05 DBBUFD OCCURS 2 PIC S9(9) COMP. 05 FILLER PIC X(4088). DSET-LIST. 05 DSET OCCURS 100 TIMES PIC S9(4) COMP. DATA-BASE-LIST. 05 DBASE OCCURS 100 TIMES PIC S9(4) COMP. LINEBUF. 05 LINEBUF-70 PIC X(70). 05 LINEBUF-OTHER PIC X(66).
* ONE THEN WE CAN ASSUME THAT THE PROCEDURE HAS BEEN * * CALLED AGAIN, AND WE NOW HAVE THE ENTRY FROM THE * * SHIP-D DATA SET. * *--------------------------------------------------------* IF CALL-NUM = 1 THEN MOVE 1 TO INDX ELSE MOVE 2 TO INDX. DIVIDE DBBUFD(INDX) BY 1000 GIVING YEAR. MULTIPLY YEAR BY 1000 GIVING HOLD. SUBTRACT HOLD FROM DBBUFD(INDX) GIVING I-DAY. MULTIPLY YEAR BY 512 GIVING D-JDATE. ADD I-DAY TO D-JDATE. CALL INTRINSIC "FMTCALENDAR" USING I-JDATE(2), FMTDATE.
(* THE NOTES APPEAR AT THE END OF THE PROCEDURE. *) (* *) (*------------------------------------------------------*) (* THIS PROCEDURE TAKES A JULIAN DATE AND CONVERTS IT *) (* TO "DAY, MONTH, YEAR" FORMAT BY CALLING THE MPE *) (* INTRINSIC FMTCALENDAR. *) (*------------------------------------------------------*) PROGRAM PASPROC(INPUT,OUTPUT); TYPE SMALLINT = -32768..32767; DBBUF_REC = RECORD CASE INTEGER OF (* 1 *) 0 : (DBBUF_CHAR : PACKED ARRAY [1..4102] OF CHAR); 1 : (DBBUF_INT : ARRAY [1..
HOLD_BUF: RECORD CASE INTEGER OF 0 : (SINGLE_INT : ARRAY [1..2] OF SMALLINT); 1 : (DOUBLE_INT : INTEGER); END; PROCEDURE FMTCALENDAR; INTRINSIC; (*--------------------------------------------------------*) (* THERE ARE TWO DATES IN THE DATA BASE TO BE FORMATTED. *) (* ONE IS IN THE ORDER-D DATA SET, THE OTHER IS IN THE *) (* SHIP-D DATA SET. BECAUSE THE SETS HAVE BEEN JOINED, *) (* IT IS POSSIBLE TO GET BOTH DATES AND FORMAT THEM.
DATA_BASE_NAME.BDB_NAME := 'ACCTS DATA_SET_NAME.BDS_NAME := 'SHIP-D '; CALLAGAIN := -1; END '; (* 4 *) ELSE (* SHIP-D DATA SET *) BEGIN M := 1; FOR N := 39 TO 55 DO BEGIN LINEBUF.BLINEBUF[N] := FMTDATE [M]; M := M + 1; END; CALLAGAIN := 0; END; END; BEGIN END. PASCAL Notes (* 1 *) Variant records can be used when it is necessary to access arrays that contain di erent data types. Variant records are allocated the maximum amount of storage needed for the record.
Additional Comments If you wish to use PASCAL I/O to help debug your procedure you must do it the following way: REWRITE (output, '$STDLIST'); WRITELN (output, 'message'); FORTRAN - MPROC Procedure $CONTROL FREE #-------------------------------------------------------# # YOU WILL NOT WANT TO INITIALIZE THE USL FILE IF YOU # # ARE COMPILING DIFFERENT SUBPROGRAMS INTO IT.
# SYSTEM INTRINSIC FMTCALENDAR # #--------------------------------------------------------# # THERE ARE TWO DATES IN THE DATA BASE TO BE FORMATTED. # # ONE IS IN THE ORDER-D DATA SET, THE OTHER IS IN THE # # SHIP-D DATA SET. BECAUSE THE SETS HAVE BEEN JOINED, # # IT IS POSSIBLE TO GET BOTH DATES AND FORMAT THEM. # # NOTE: IT IS THE APPLICATION'S RESPONSIBILITY TO KNOW # # WHERE IN THE DATA BUFFER THE VALUE IS LOCATED.
DO 285 N = 1, 8 DSNAME(N) = INTDSNAME(M) 285 M = M + 1 CALLAGAIN = .TRUE. GOTO 400 # 300 M = 1 DO 350 N = 21, 29 LINEBUF(N) = FMTDATE(M) 350 M = M + 1 CALLAGAIN = .FALSE. # 400 RETURN END QPROC Procedure The following examples show the QPROC user-de ned procedure in two languages: SPL and COBOL. This procedure displays the parameter values when it is called from QUERY. You can interactively change the parameters which can be modi ed by user-de ned procedures. The changes can a ect the data returned.
$PAGE "QPROC: Procedure Global Variables.
<<---------------------------------------------------------------->> << PAGE EJECT >> <<---------------------------------------------------------------->> move BUF := "-- PAGE EJECT -- (CHANGE to True or False)"; PRINT( BUF, 0, %40 ); PRINT( BUF, -42, %40 ); if PAGE'EJECT = TRUE then move BUF := "--TRUE-- "; if PAGE'EJECT = FALSE then move BUF := "--FALSE--"; PRINT( BUF, -9, %40 ); I := READ( BUF, -5 ); if I<>0 and (BUF'B = "T" or BUF'B = "t") then PAGE'EJECT:= TRUE; if I<>0 and (BUF'B = "F" or BUF'B = "f")
PRINT( BUF, 0, %40 ); PRINT( BUF, -20, %40 ); move BUF'B(0) := (79(" ") ); J := 0; For I := 0 step 8 until 72 do begin NUM'CHAR := ASCII( DATA'BASE'LIST(J), 10, BUF'B(I) );J:=J+1;end; PRINT (BUF, -79, %40 ); <<---------------------------------------------------------------->> << PRINT LINE BUFFER >> <<---------------------------------------------------------------->> move BUF'B:="--LINE BUFFER -- "; PRINT( BUF, 0, %40 ); PRINT( BUF, -16, %40 ); PRINT( LINEBUF, -79, %40 ); I := READ( LINEBUF, -79 ); PRINT'RE
if BUF'B(J) = "." then DEC'PTR := J; if BUF'B(J) <> "," and BUF'B(J) <> ".
PRINT( BUF, 0, %40 ); PRINT( BUF, -17, %40 ); NUM'CHAR:=ASCII( CALL'NUM, 10, BUF'B ); PRINT( BUF, -NUM'CHAR, %40 ); <<---------------------------------------------------------------->> << LINES LEFT >> <<---------------------------------------------------------------->> move BUF := "-- LINES LEFT -- "; PRINT( BUF, 0, %40 ); PRINT( BUF, -16, %40 ); NUM'CHAR:=ASCII( LINES'LEFT, 10, BUF'B ); PRINT( BUF, -NUM'CHAR, %40 ); <<---------------------------------------------------------------->> << PAGE NUMBER >> <<-
DATA DIVISION. WORKING-STORAGE SECTION. 01 BUF. 05 BUFX OCCURS 136 TIMES PIC X. 01 REG-NBR PIC S9(4) COMP. LINKAGE SECTION. 01 CALLAGAIN PIC S9(4) COMP. 01 PAGE-EJECT PIC S9(4) COMP. 01 BASE-IDS. 05 BASE-ID1 PIC S9(4) COMP. 05 BASE-NAME1 PIC X(24). 05 BASE-ID2 PIC S9(4) COMP. 05 BASE-NAME2 PIC X(24). 05 BASE-ID-OTHERS PIC X(208). 01 DBBUF. 05 DBBUF-70 PIC X(70). 05 DBBUFI REDEFINES DBBUF-70 OCCURS 35 TIMES PIC S9(4) COMP. 05 DBBUF-OTHER PIC X(4026). 01 DSET-LIST. 05 DSET OCCURS 100 TIMES PIC S9(4) COMP.
DISPLAY SPACE. DISPLAY "-- CALL AGAIN -- (CHANGE to True or False) ". MOVE SPACE TO BUF. ACCEPT BUF. IF BUFX(1) = "T" OR BUFX(1) = "t" THEN MOVE -1 TO CALLAGAIN. IF BUFX(1) = "F" OR BUFX(1) = "f" THEN MOVE 0 TO CALLAGAIN. *--------------------------------------------------------* * PAGE EJECT * *--------------------------------------------------------* DISPLAY SPACE. DISPLAY "-- PAGE EJECT -- (CHANGE to True or False) ". MOVE SPACE TO BUF. ACCEPT BUF.
*--------------------------------------------------------* * PRINT REGISTER ARRAY * * (Packed decimal is assumed) * *--------------------------------------------------------* DISPLAY SPACE. DISPLAY-REGISTERS. DISPLAY " ". DISPLAY "-- REGISTER DISPLAY REG(1), " ", DISPLAY REG(4), " ", DISPLAY REG(7), " ", ARRAY -- (0-8 Displayed)". REG(2), " ", REG(3), " ". REG(5), " ", REG(6), " ". REG(8), " ", REG(9), " ". ACCEPT-REGISTERS. DISPLAY "CHANGE A REGISTER (Yes/No)?". MOVE SPACE TO BUF. ACCEPT BUF.
DISPLAY SPACE. DISPLAY "-- CALL NUMBER --". DISPLAY CALL-NUM. *--------------------------------------------------------* * LINES LEFT * *--------------------------------------------------------* DISPLAY SPACE. DISPLAY "-- LINES LEFT --". DISPLAY LINES-LEFT. *--------------------------------------------------------* * PAGE NUMBER * *--------------------------------------------------------* DISPLAY SPACE. DISPLAY "-- PAGE NUMBER --". DISPLAY PAGENO.
G ASCII CHARACTER SET This appendix is not available in this edition.